WP Offload S3 Lite - Version 2.0

Version Description

This is a major upgrade that introduces support for DigitalOcean Spaces, renames the plugin to WP Offload Media Lite, and coincidentally upgrades some of its database settings. You may not be able to downgrade to WP Offload S3 Lite 1.x after upgrading to WP Offload Media Lite 2.0+.

Download this release

Release Info

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

Code changes from version 1.4.3 to 2.0

Files changed (304) hide show
  1. README.md +45 -26
  2. assets/css/attachment.css +1 -1
  3. assets/css/notice.css +1 -1
  4. assets/css/storage-provider.css +1 -0
  5. assets/css/styles.css +1 -1
  6. assets/img/do-logo.svg +6 -0
  7. assets/js/media.js +17 -17
  8. assets/js/media.min.js +1 -1
  9. assets/js/modal.js +4 -0
  10. assets/js/modal.min.js +1 -1
  11. assets/js/script.js +75 -121
  12. assets/js/script.min.js +1 -1
  13. assets/js/storage-provider.js +85 -0
  14. assets/js/storage-provider.min.js +1 -0
  15. assets/sass/attachment.scss +6 -2
  16. assets/sass/notice.scss +1 -1
  17. assets/sass/storage-provider.scss +112 -0
  18. assets/sass/styles.scss +85 -71
  19. classes/amazon-s3-and-cloudfront.php +599 -528
  20. classes/as3cf-compatibility-check.php +3 -2
  21. classes/as3cf-error.php +1 -1
  22. classes/as3cf-notices.php +1 -1
  23. classes/as3cf-plugin-base.php +29 -12
  24. classes/as3cf-plugin-compatibility.php +66 -64
  25. classes/as3cf-utils.php +103 -14
  26. classes/filters/as3cf-local-to-s3.php +2 -1
  27. classes/filters/as3cf-s3-to-local.php +2 -1
  28. classes/providers/aws-provider.php +132 -17
  29. classes/providers/digitalocean-provider.php +179 -0
  30. classes/providers/null-provider.php +3 -3
  31. classes/providers/provider.php +308 -25
  32. classes/providers/streams/aws-s3-stream-wrapper.php +7 -6
  33. classes/upgrades/exceptions/batch-limits-exceeded-exception.php +1 -1
  34. classes/upgrades/exceptions/no-more-blogs-exception.php +1 -1
  35. classes/upgrades/exceptions/too-many-errors-exception.php +1 -1
  36. classes/upgrades/network-upgrade.php +1 -1
  37. classes/upgrades/upgrade-content-replace-urls.php +5 -5
  38. classes/upgrades/upgrade-edd-replace-urls.php +1 -1
  39. classes/upgrades/upgrade-file-sizes.php +14 -14
  40. classes/upgrades/upgrade-filter-post-excerpt.php +1 -1
  41. classes/upgrades/upgrade-filter-post.php +4 -4
  42. classes/upgrades/upgrade-meta-wp-error.php +9 -9
  43. classes/upgrades/upgrade-region-meta.php +7 -7
  44. classes/upgrades/upgrade-wpos3-to-as3cf.php +107 -0
  45. classes/upgrades/upgrade.php +6 -6
  46. composer.json +2 -2
  47. languages/amazon-s3-and-cloudfront-en.pot +359 -301
  48. readme.txt +39 -24
  49. vendor/Aws3/Aws/Api/AbstractModel.php +3 -3
  50. vendor/Aws3/Aws/Api/ApiProvider.php +5 -5
  51. vendor/Aws3/Aws/Api/DateTimeResult.php +1 -1
  52. vendor/Aws3/Aws/Api/DocModel.php +1 -1
  53. vendor/Aws3/Aws/Api/ErrorParser/JsonParserTrait.php +4 -4
  54. vendor/Aws3/Aws/Api/ErrorParser/JsonRpcErrorParser.php +3 -3
  55. vendor/Aws3/Aws/Api/ErrorParser/RestJsonErrorParser.php +3 -3
  56. vendor/Aws3/Aws/Api/ErrorParser/XmlErrorParser.php +5 -5
  57. vendor/Aws3/Aws/Api/ListShape.php +4 -4
  58. vendor/Aws3/Aws/Api/MapShape.php +5 -5
  59. vendor/Aws3/Aws/Api/Operation.php +5 -5
  60. vendor/Aws3/Aws/Api/Parser/AbstractParser.php +7 -7
  61. vendor/Aws3/Aws/Api/Parser/AbstractRestParser.php +16 -16
  62. vendor/Aws3/Aws/Api/Parser/Crc32ValidatingParser.php +9 -9
  63. vendor/Aws3/Aws/Api/Parser/Exception/ParserException.php +1 -1
  64. vendor/Aws3/Aws/Api/Parser/JsonParser.php +5 -5
  65. vendor/Aws3/Aws/Api/Parser/JsonRpcParser.php +10 -10
  66. vendor/Aws3/Aws/Api/Parser/PayloadParserTrait.php +4 -4
  67. vendor/Aws3/Aws/Api/Parser/QueryParser.php +10 -10
  68. vendor/Aws3/Aws/Api/Parser/RestJsonParser.php +8 -8
  69. vendor/Aws3/Aws/Api/Parser/RestXmlParser.php +8 -8
  70. vendor/Aws3/Aws/Api/Parser/XmlParser.php +17 -17
  71. vendor/Aws3/Aws/Api/Serializer/Ec2ParamBuilder.php +7 -7
  72. vendor/Aws3/Aws/Api/Serializer/JsonBody.php +9 -9
  73. vendor/Aws3/Aws/Api/Serializer/JsonRpcSerializer.php +10 -10
  74. vendor/Aws3/Aws/Api/Serializer/QueryParamBuilder.php +17 -17
  75. vendor/Aws3/Aws/Api/Serializer/QuerySerializer.php +9 -9
  76. vendor/Aws3/Aws/Api/Serializer/RestJsonSerializer.php +8 -8
  77. vendor/Aws3/Aws/Api/Serializer/RestSerializer.php +27 -27
  78. vendor/Aws3/Aws/Api/Serializer/RestXmlSerializer.php +7 -7
  79. vendor/Aws3/Aws/Api/Serializer/XmlBody.php +21 -21
  80. vendor/Aws3/Aws/Api/Service.php +14 -14
  81. vendor/Aws3/Aws/Api/Shape.php +4 -4
  82. vendor/Aws3/Aws/Api/ShapeMap.php +2 -2
  83. vendor/Aws3/Aws/Api/StructureShape.php +3 -3
  84. vendor/Aws3/Aws/Api/TimestampShape.php +3 -3
  85. vendor/Aws3/Aws/Api/Validator.php +18 -18
  86. vendor/Aws3/Aws/AwsClient.php +19 -19
  87. vendor/Aws3/Aws/AwsClientInterface.php +5 -5
  88. vendor/Aws3/Aws/AwsClientTrait.php +6 -6
  89. vendor/Aws3/Aws/CacheInterface.php +1 -1
  90. vendor/Aws3/Aws/ClientResolver.php +52 -52
  91. vendor/Aws3/Aws/Command.php +4 -4
  92. vendor/Aws3/Aws/CommandInterface.php +1 -1
  93. vendor/Aws3/Aws/CommandPool.php +7 -7
  94. vendor/Aws3/Aws/Credentials/AssumeRoleCredentialProvider.php +7 -7
  95. vendor/Aws3/Aws/Credentials/CredentialProvider.php +17 -17
  96. vendor/Aws3/Aws/Credentials/Credentials.php +2 -2
  97. vendor/Aws3/Aws/Credentials/CredentialsInterface.php +1 -1
  98. vendor/Aws3/Aws/Credentials/EcsCredentialProvider.php +11 -11
  99. vendor/Aws3/Aws/Credentials/InstanceProfileProvider.php +14 -14
  100. vendor/Aws3/Aws/Crypto/AbstractCryptoClient.php +6 -6
  101. vendor/Aws3/Aws/Crypto/AesDecryptingStream.php +6 -6
  102. vendor/Aws3/Aws/Crypto/AesEncryptingStream.php +6 -6
  103. vendor/Aws3/Aws/Crypto/AesGcmDecryptingStream.php +7 -7
  104. vendor/Aws3/Aws/Crypto/AesGcmEncryptingStream.php +7 -7
  105. vendor/Aws3/Aws/Crypto/AesStreamInterface.php +2 -2
  106. vendor/Aws3/Aws/Crypto/Cipher/Cbc.php +2 -2
  107. vendor/Aws3/Aws/Crypto/Cipher/CipherBuilderTrait.php +2 -2
  108. vendor/Aws3/Aws/Crypto/Cipher/CipherMethod.php +1 -1
  109. vendor/Aws3/Aws/Crypto/DecryptionTrait.php +15 -15
  110. vendor/Aws3/Aws/Crypto/EncryptionTrait.php +19 -19
  111. vendor/Aws3/Aws/Crypto/KmsMaterialsProvider.php +8 -8
  112. vendor/Aws3/Aws/Crypto/MaterialsProvider.php +2 -2
  113. vendor/Aws3/Aws/Crypto/MetadataEnvelope.php +2 -2
  114. vendor/Aws3/Aws/Crypto/MetadataStrategyInterface.php +2 -2
  115. vendor/Aws3/Aws/DoctrineCacheAdapter.php +4 -4
  116. vendor/Aws3/Aws/Endpoint/EndpointProvider.php +5 -5
  117. vendor/Aws3/Aws/Endpoint/Partition.php +3 -3
  118. vendor/Aws3/Aws/Endpoint/PartitionEndpointProvider.php +3 -3
  119. vendor/Aws3/Aws/Endpoint/PartitionInterface.php +1 -1
  120. vendor/Aws3/Aws/Endpoint/PatternEndpointProvider.php +1 -1
  121. vendor/Aws3/Aws/Exception/AwsException.php +6 -6
  122. vendor/Aws3/Aws/Exception/CouldNotCreateChecksumException.php +1 -1
  123. vendor/Aws3/Aws/Exception/CredentialsException.php +1 -1
  124. vendor/Aws3/Aws/Exception/MultipartUploadException.php +3 -3
  125. vendor/Aws3/Aws/Exception/UnresolvedApiException.php +1 -1
  126. vendor/Aws3/Aws/Exception/UnresolvedEndpointException.php +1 -1
  127. vendor/Aws3/Aws/Exception/UnresolvedSignatureException.php +1 -1
  128. vendor/Aws3/Aws/Handler/GuzzleV5/GuzzleHandler.php +27 -27
  129. vendor/Aws3/Aws/Handler/GuzzleV5/GuzzleStream.php +6 -6
  130. vendor/Aws3/Aws/Handler/GuzzleV5/PsrStream.php +6 -6
  131. vendor/Aws3/Aws/Handler/GuzzleV6/GuzzleHandler.php +14 -14
  132. vendor/Aws3/Aws/HandlerList.php +1 -1
  133. vendor/Aws3/Aws/HasDataTrait.php +1 -1
  134. vendor/Aws3/Aws/HashInterface.php +1 -1
  135. vendor/Aws3/Aws/HashingStream.php +5 -5
  136. vendor/Aws3/Aws/History.php +4 -4
  137. vendor/Aws3/Aws/IdempotencyTokenMiddleware.php +6 -6
  138. vendor/Aws3/Aws/JsonCompiler.php +1 -1
  139. vendor/Aws3/Aws/LruArrayCache.php +2 -2
  140. vendor/Aws3/Aws/Middleware.php +34 -34
  141. vendor/Aws3/Aws/MockHandler.php +8 -8
  142. vendor/Aws3/Aws/MultiRegionClient.php +12 -12
  143. vendor/Aws3/Aws/Multipart/AbstractUploadManager.php +24 -24
  144. vendor/Aws3/Aws/Multipart/AbstractUploader.php +10 -10
  145. vendor/Aws3/Aws/Multipart/UploadState.php +1 -1
  146. vendor/Aws3/Aws/PhpHash.php +2 -2
  147. vendor/Aws3/Aws/PresignUrlMiddleware.php +15 -15
  148. vendor/Aws3/Aws/PsrCacheAdapter.php +4 -4
  149. vendor/Aws3/Aws/Result.php +4 -4
  150. vendor/Aws3/Aws/ResultInterface.php +1 -1
  151. vendor/Aws3/Aws/ResultPaginator.php +7 -7
  152. vendor/Aws3/Aws/RetryMiddleware.php +9 -9
  153. vendor/Aws3/Aws/S3/AmbiguousSuccessParser.php +8 -8
  154. vendor/Aws3/Aws/S3/ApplyChecksumMiddleware.php +6 -6
  155. vendor/Aws3/Aws/S3/BatchDelete.php +17 -17
  156. vendor/Aws3/Aws/S3/BucketEndpointMiddleware.php +6 -6
  157. vendor/Aws3/Aws/S3/Crypto/CryptoParamsTrait.php +12 -12
  158. vendor/Aws3/Aws/S3/Crypto/HeadersMetadataStrategy.php +7 -7
  159. vendor/Aws3/Aws/S3/Crypto/InstructionFileMetadataStrategy.php +9 -9
  160. vendor/Aws3/Aws/S3/Crypto/S3EncryptionClient.php +20 -20
  161. vendor/Aws3/Aws/S3/Crypto/S3EncryptionMultipartUploader.php +13 -13
  162. vendor/Aws3/Aws/S3/Exception/DeleteMultipleObjectsException.php +1 -1
  163. vendor/Aws3/Aws/S3/Exception/PermanentRedirectException.php +2 -2
  164. vendor/Aws3/Aws/S3/Exception/S3Exception.php +3 -3
  165. vendor/Aws3/Aws/S3/Exception/S3MultipartUploadException.php +7 -7
  166. vendor/Aws3/Aws/S3/GetBucketLocationParser.php +6 -6
  167. vendor/Aws3/Aws/S3/MultipartCopy.php +8 -8
  168. vendor/Aws3/Aws/S3/MultipartUploader.php +19 -19
  169. vendor/Aws3/Aws/S3/MultipartUploadingTrait.php +12 -12
  170. vendor/Aws3/Aws/S3/ObjectCopier.php +10 -10
  171. vendor/Aws3/Aws/S3/ObjectUploader.php +13 -13
  172. vendor/Aws3/Aws/S3/PermanentRedirectMiddleware.php +8 -8
  173. vendor/Aws3/Aws/S3/PostObject.php +6 -6
  174. vendor/Aws3/Aws/S3/PostObjectV4.php +11 -11
  175. vendor/Aws3/Aws/S3/PutObjectUrlMiddleware.php +6 -6
  176. vendor/Aws3/Aws/S3/RetryableMalformedResponseParser.php +9 -9
  177. vendor/Aws3/Aws/S3/S3Client.php +40 -40
  178. vendor/Aws3/Aws/S3/S3ClientInterface.php +7 -7
  179. vendor/Aws3/Aws/S3/S3ClientTrait.php +21 -21
  180. vendor/Aws3/Aws/S3/S3EndpointMiddleware.php +15 -15
  181. vendor/Aws3/Aws/S3/S3MultiRegionClient.php +15 -15
  182. vendor/Aws3/Aws/S3/S3UriParser.php +8 -8
  183. vendor/Aws3/Aws/S3/SSECMiddleware.php +5 -5
  184. vendor/Aws3/Aws/S3/StreamWrapper.php +16 -16
  185. vendor/Aws3/Aws/S3/Transfer.php +18 -18
  186. vendor/Aws3/Aws/Sdk.php +4 -4
  187. vendor/Aws3/Aws/Signature/AnonymousSignature.php +6 -6
  188. vendor/Aws3/Aws/Signature/S3SignatureV4.php +8 -8
  189. vendor/Aws3/Aws/Signature/SignatureInterface.php +5 -5
  190. vendor/Aws3/Aws/Signature/SignatureProvider.php +6 -6
  191. vendor/Aws3/Aws/Signature/SignatureTrait.php +1 -1
  192. vendor/Aws3/Aws/Signature/SignatureV4.php +20 -20
  193. vendor/Aws3/Aws/TraceMiddleware.php +14 -14
  194. vendor/Aws3/Aws/Waiter.php +10 -10
  195. vendor/Aws3/Aws/WrappedHttpHandler.php +12 -12
  196. vendor/Aws3/Aws/functions.php +10 -10
  197. vendor/Aws3/GuzzleHttp/Client.php +32 -32
  198. vendor/Aws3/GuzzleHttp/ClientInterface.php +8 -8
  199. vendor/Aws3/GuzzleHttp/Cookie/CookieJar.php +18 -18
  200. vendor/Aws3/GuzzleHttp/Cookie/CookieJarInterface.php +6 -6
  201. vendor/Aws3/GuzzleHttp/Cookie/FileCookieJar.php +6 -6
  202. vendor/Aws3/GuzzleHttp/Cookie/SessionCookieJar.php +4 -4
  203. vendor/Aws3/GuzzleHttp/Cookie/SetCookie.php +1 -1
  204. vendor/Aws3/GuzzleHttp/Exception/BadResponseException.php +5 -5
  205. vendor/Aws3/GuzzleHttp/Exception/ClientException.php +2 -2
  206. vendor/Aws3/GuzzleHttp/Exception/ConnectException.php +4 -4
  207. vendor/Aws3/GuzzleHttp/Exception/GuzzleException.php +1 -1
  208. vendor/Aws3/GuzzleHttp/Exception/RequestException.php +13 -13
  209. vendor/Aws3/GuzzleHttp/Exception/SeekException.php +4 -4
  210. vendor/Aws3/GuzzleHttp/Exception/ServerException.php +2 -2
  211. vendor/Aws3/GuzzleHttp/Exception/TooManyRedirectsException.php +2 -2
  212. vendor/Aws3/GuzzleHttp/Exception/TransferException.php +2 -2
  213. vendor/Aws3/GuzzleHttp/Handler/CurlFactory.php +33 -33
  214. vendor/Aws3/GuzzleHttp/Handler/CurlFactoryInterface.php +4 -4
  215. vendor/Aws3/GuzzleHttp/Handler/CurlHandler.php +6 -6
  216. vendor/Aws3/GuzzleHttp/Handler/CurlMultiHandler.php +11 -11
  217. vendor/Aws3/GuzzleHttp/Handler/EasyHandle.php +8 -8
  218. vendor/Aws3/GuzzleHttp/Handler/MockHandler.php +16 -16
  219. vendor/Aws3/GuzzleHttp/Handler/Proxy.php +6 -6
  220. vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php +43 -43
  221. vendor/Aws3/GuzzleHttp/HandlerStack.php +7 -7
  222. vendor/Aws3/GuzzleHttp/MessageFormatter.php +8 -8
  223. vendor/Aws3/GuzzleHttp/Middleware.php +16 -16
  224. vendor/Aws3/GuzzleHttp/Pool.php +9 -9
  225. vendor/Aws3/GuzzleHttp/PrepareBodyMiddleware.php +8 -8
  226. vendor/Aws3/GuzzleHttp/Promise/AggregateException.php +2 -2
  227. vendor/Aws3/GuzzleHttp/Promise/CancellationException.php +2 -2
  228. vendor/Aws3/GuzzleHttp/Promise/Coroutine.php +3 -3
  229. vendor/Aws3/GuzzleHttp/Promise/EachPromise.php +5 -5
  230. vendor/Aws3/GuzzleHttp/Promise/FulfilledPromise.php +3 -3
  231. vendor/Aws3/GuzzleHttp/Promise/Promise.php +4 -4
  232. vendor/Aws3/GuzzleHttp/Promise/PromiseInterface.php +1 -1
  233. vendor/Aws3/GuzzleHttp/Promise/PromisorInterface.php +1 -1
  234. vendor/Aws3/GuzzleHttp/Promise/RejectedPromise.php +3 -3
  235. vendor/Aws3/GuzzleHttp/Promise/RejectionException.php +1 -1
  236. vendor/Aws3/GuzzleHttp/Promise/TaskQueue.php +2 -2
  237. vendor/Aws3/GuzzleHttp/Promise/TaskQueueInterface.php +1 -1
  238. vendor/Aws3/GuzzleHttp/Promise/functions.php +29 -29
  239. vendor/Aws3/GuzzleHttp/Promise/functions_include.php +1 -1
  240. vendor/Aws3/GuzzleHttp/Psr7/AppendStream.php +4 -4
  241. vendor/Aws3/GuzzleHttp/Psr7/BufferStream.php +3 -3
  242. vendor/Aws3/GuzzleHttp/Psr7/CachingStream.php +6 -6
  243. vendor/Aws3/GuzzleHttp/Psr7/DroppingStream.php +4 -4
  244. vendor/Aws3/GuzzleHttp/Psr7/FnStream.php +4 -4
  245. vendor/Aws3/GuzzleHttp/Psr7/InflateStream.php +8 -8
  246. vendor/Aws3/GuzzleHttp/Psr7/LazyOpenStream.php +3 -3
  247. vendor/Aws3/GuzzleHttp/Psr7/LimitStream.php +4 -4
  248. vendor/Aws3/GuzzleHttp/Psr7/MessageTrait.php +3 -3
  249. vendor/Aws3/GuzzleHttp/Psr7/MultipartStream.php +6 -6
  250. vendor/Aws3/GuzzleHttp/Psr7/NoSeekStream.php +3 -3
  251. vendor/Aws3/GuzzleHttp/Psr7/PumpStream.php +4 -4
  252. vendor/Aws3/GuzzleHttp/Psr7/Request.php +7 -7
  253. vendor/Aws3/GuzzleHttp/Psr7/Response.php +4 -4
  254. vendor/Aws3/GuzzleHttp/Psr7/ServerRequest.php +10 -10
  255. vendor/Aws3/GuzzleHttp/Psr7/Stream.php +3 -3
  256. vendor/Aws3/GuzzleHttp/Psr7/StreamDecoratorTrait.php +3 -3
  257. vendor/Aws3/GuzzleHttp/Psr7/StreamWrapper.php +3 -3
  258. vendor/Aws3/GuzzleHttp/Psr7/UploadedFile.php +7 -7
  259. vendor/Aws3/GuzzleHttp/Psr7/Uri.php +15 -15
  260. vendor/Aws3/GuzzleHttp/Psr7/UriNormalizer.php +9 -9
  261. vendor/Aws3/GuzzleHttp/Psr7/UriResolver.php +7 -7
  262. vendor/Aws3/GuzzleHttp/Psr7/functions.php +24 -24
  263. vendor/Aws3/GuzzleHttp/Psr7/functions_include.php +1 -1
  264. vendor/Aws3/GuzzleHttp/RedirectMiddleware.php +21 -21
  265. vendor/Aws3/GuzzleHttp/RequestOptions.php +1 -1
  266. vendor/Aws3/GuzzleHttp/RetryMiddleware.php +11 -11
  267. vendor/Aws3/GuzzleHttp/TransferStats.php +5 -5
  268. vendor/Aws3/GuzzleHttp/UriTemplate.php +1 -1
  269. vendor/Aws3/GuzzleHttp/functions.php +11 -11
  270. vendor/Aws3/GuzzleHttp/functions_include.php +1 -1
  271. vendor/Aws3/JmesPath/AstRuntime.php +5 -5
  272. vendor/Aws3/JmesPath/CompilerRuntime.php +5 -5
  273. vendor/Aws3/JmesPath/DebugRuntime.php +5 -5
  274. vendor/Aws3/JmesPath/Env.php +5 -5
  275. vendor/Aws3/JmesPath/FnDispatcher.php +10 -10
  276. vendor/Aws3/JmesPath/JmesPath.php +2 -2
  277. vendor/Aws3/JmesPath/Lexer.php +1 -1
  278. vendor/Aws3/JmesPath/Parser.php +55 -55
  279. vendor/Aws3/JmesPath/SyntaxErrorException.php +1 -1
  280. vendor/Aws3/JmesPath/TreeCompiler.php +1 -1
  281. vendor/Aws3/JmesPath/TreeInterpreter.php +13 -13
  282. vendor/Aws3/JmesPath/Utils.php +1 -1
  283. vendor/Aws3/Psr/Http/Message/MessageInterface.php +2 -2
  284. vendor/Aws3/Psr/Http/Message/RequestInterface.php +2 -2
  285. vendor/Aws3/Psr/Http/Message/ResponseInterface.php +1 -1
  286. vendor/Aws3/Psr/Http/Message/ServerRequestInterface.php +1 -1
  287. vendor/Aws3/Psr/Http/Message/StreamInterface.php +1 -1
  288. vendor/Aws3/Psr/Http/Message/UploadedFileInterface.php +1 -1
  289. vendor/Aws3/Psr/Http/Message/UriInterface.php +1 -1
  290. vendor/Aws3/aws-autoloader.php +1 -1
  291. view/attachment-metabox.php +20 -11
  292. view/bucket-select.php +126 -28
  293. view/bucket-setting.php +17 -11
  294. view/domain-setting.php +6 -6
  295. view/provider-select.php +234 -0
  296. view/provider-setting.php +13 -0
  297. view/settings.php +0 -1
  298. view/settings/addons.php +1 -1
  299. view/settings/media.php +122 -71
  300. view/settings/settings.php +0 -136
  301. view/sidebar.php +4 -4
  302. view/wordpress-org-support.php +1 -1
  303. wordpress-s3.php +7 -7
  304. wp-offload-s3-autoloader.php → wp-offload-media-autoloader.php +2 -2
README.md CHANGED
@@ -1,68 +1,81 @@
1
- # WP Offload S3 Lite #
2
- **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
**Requires PHP:** 5.5
7
- **Stable tag:** 1.4.3
8
**License:** GPLv3
9
10
- Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
11
12
## Description ##
13
14
https://www.youtube.com/watch?v=_PVybEGaRXc
15
16
- This plugin automatically copies images, videos, documents, and any other media added through WordPress' media uploader to [Amazon S3](http://aws.amazon.com/s3/). It then automatically replaces the URL to each media file with their respective Amazon S3 URL or, if you have configured [Amazon CloudFront](http://aws.amazon.com/cloudfront/), the respective CloudFront URL. Image thumbnails are also copied to Amazon S3 and delivered through S3/CloudFront.
17
18
- Uploading files *directly* to your Amazon S3 account is not currently supported by this plugin. They are uploaded to your server first, then copied to Amazon S3. There is an option to automatically remove the files from your server once they are copied to Amazon S3 however.
19
20
- If you're adding this plugin to a site that's been around for a while, your existing media files will not be copied or served from Amazon S3. Only newly uploaded files will be copied and served from Amazon S3. The pro upgrade has an upload tool to handle existing media files.
21
22
**PRO Upgrade with Email Support and More Features**
23
24
- * Upload existing Media Library to Amazon S3
25
- * Control Amazon S3 files from the Media Library
26
- * [Assets addon](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=assets%2Baddon#addons) - Serve your CSS & JS from Amazon S3/CloudFront
27
- * [WooCommerce integration](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=woocommerce%2Baddon#integrations)
28
- * [Easy Digital Downloads integration](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=edd%2Baddon#integrations)
29
* PriorityExpert™ email support
30
31
- [Compare pro vs free →](https://deliciousbrains.com/wp-offload-s3/upgrade/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
32
33
The video below runs through the pro upgrade features...
34
35
https://www.youtube.com/watch?v=55xNGnbJ_CY
36
37
- *This plugin has been completely rewritten, but was originally a fork of
38
- [Amazon S3 for WordPress with CloudFront](http://wordpress.org/extend/plugins/tantan-s3-cloudfront/)
39
- which is a fork of [Amazon S3 for WordPress](http://wordpress.org/extend/plugins/tantan-s3/), also known as tantan-s3.*
40
41
## Installation ##
42
43
1. Install this plugin using WordPress' built-in installer
44
- 2. Access the *Offload S3* option under *Settings*
45
- 3. Follow the instructions to setup your AWS access keys and configure
46
47
- Check out the [Quick Start Guide](https://deliciousbrains.com/wp-offload-s3/doc/quick-start-guide/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) for more information on configuring WP Offload S3.
48
49
## Frequently Asked Questions ##
50
51
### What are the minimum requirements? ###
52
53
- You can see the minimum requirements [here](https://deliciousbrains.com/wp-offload-s3/pricing/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=requirements#requirements).
54
55
## Screenshots ##
56
57
- ### 1. Choosing/creating a bucket ###
58
- ![Choosing/creating a bucket](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-s3-lite/assets/screenshot-1.png)
59
60
- ### 2. Settings screen ###
61
- ![Settings screen](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-s3-lite/assets/screenshot-2.png)
62
63
64
## Upgrade Notice ##
65
66
### 1.1 ###
67
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.
68
@@ -71,6 +84,12 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
71
72
## Changelog ##
73
74
### WP Offload S3 Lite 1.4.3 - 2018-08-02 ###
75
* Bug fix: Images remotely edited via stream wrapper sometimes set as private on S3
76
1
+ # WP Offload Media Lite for Amazon S3 and DigitalOcean Spaces #
2
+ **Contributors:** bradt, deliciousbrains, ianmjones
3
+ **Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, mirror, admin, media, cdn, cloudfront
4
+ **Requires at least:** 4.7
5
**Tested up to:** 4.9
6
**Requires PHP:** 5.5
7
+ **Stable tag:** 2.0
8
**License:** GPLv3
9
10
+ Copies files to Amazon S3 or DigitalOcean Spaces as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
11
12
## Description ##
13
14
+ FORMERLY WP OFFLOAD S3 LITE
15
+
16
https://www.youtube.com/watch?v=_PVybEGaRXc
17
18
+ This plugin automatically copies images, videos, documents, and any other media added through WordPress' media uploader to [Amazon S3](http://aws.amazon.com/s3/) or [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/). It then automatically replaces the URL to each media file with their respective Amazon S3 or DigitalOcean Spaces URL or, if you have configured [Amazon CloudFront](http://aws.amazon.com/cloudfront/) or another CDN with or without a custom domain, that URL instead. Image thumbnails are also copied to the bucket and delivered through the correct remote URL.
19
20
+ Uploading files *directly* to your Amazon S3 or DigitalOcean Spaces account is not currently supported by this plugin. They are uploaded to your server first, then copied to the bucket. There is an option to automatically remove the files from your server once they are copied to the bucket however.
21
22
+ If you're adding this plugin to a site that's been around for a while, your existing media files will not be copied to or served from Amazon S3 or DigitalOcean Spaces. Only newly uploaded files will be copied to and served from the bucket. The pro upgrade has an upload tool to handle existing media files.
23
24
**PRO Upgrade with Email Support and More Features**
25
26
+ * Upload existing Media Library to Amazon S3 or DigitalOcean Spaces
27
+ * Control offloaded files from the Media Library
28
+ * [Assets Pull addon](https://deliciousbrains.com/wp-offload-media/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=assets%2Baddon#addons) - Serve your CSS, JS and fonts via CloudFront or another CDN
29
+ * [WooCommerce integration](https://deliciousbrains.com/wp-offload-media/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=woocommerce%2Baddon#integrations)
30
+ * [Easy Digital Downloads integration](https://deliciousbrains.com/wp-offload-media/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=edd%2Baddon#integrations)
31
* PriorityExpert™ email support
32
33
+ [Compare pro vs free →](https://deliciousbrains.com/wp-offload-media/upgrade/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
34
35
The video below runs through the pro upgrade features...
36
37
https://www.youtube.com/watch?v=55xNGnbJ_CY
38
39
+ *This plugin has been completely rewritten, but was originally a fork of [Amazon S3 for WordPress with CloudFront](http://wordpress.org/extend/plugins/tantan-s3-cloudfront/) which is a fork of [Amazon S3 for WordPress](http://wordpress.org/extend/plugins/tantan-s3/), also known as tantan-s3.*
40
41
## Installation ##
42
43
1. Install this plugin using WordPress' built-in installer
44
+ 2. Access the *Offload Media* option under *Settings*
45
+ 3. Follow the instructions to set up your AWS or DigitalOcean access keys and configure
46
47
+ Check out the [Quick Start Guide](https://deliciousbrains.com/wp-offload-media/doc/quick-start-guide/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) for more information on configuring WP Offload Media.
48
49
## Frequently Asked Questions ##
50
51
### What are the minimum requirements? ###
52
53
+ You can see the minimum requirements [here](https://deliciousbrains.com/wp-offload-media/pricing/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=requirements#requirements).
54
+
55
+ ### Do you offer email support? ###
56
+
57
+ If you upgrade to the pro version of [WP Offload Media](https://deliciousbrains.com/wp-offload-media/upgrade/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting), we will gladly provide you with email support. We take pride in delivering exceptional customer support. We do not provide email support for the free version.
58
59
## Screenshots ##
60
61
+ ### 1. Select Cloud Storage Provider ###
62
+ ![Select Cloud Storage Provider](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-1.png)
63
+
64
+ ### 2. Select or Create Bucket ###
65
+ ![Select or Create Bucket](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-2.png)
66
67
+ ### 3. Settings Screen ###
68
+ ![Settings Screen](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-3.png)
69
+
70
+ ### 4. Custom Domain Used With CDN ###
71
+ ![Custom Domain Used With CDN](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-4.png)
72
73
74
## Upgrade Notice ##
75
76
+ ### 2.0 ###
77
+ This is a major upgrade that introduces support for DigitalOcean Spaces, renames the plugin to WP Offload Media Lite, and coincidentally upgrades some of its database settings. You may not be able to downgrade to WP Offload S3 Lite 1.x after upgrading to WP Offload Media Lite 2.0+.
78
+
79
### 1.1 ###
80
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.
81
84
85
## Changelog ##
86
87
+ ### WP Offload Media Lite 2.0 - 2018-09-24 ###
88
+ * [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-supports-digitalocean-spaces/)
89
+ * New: DigitalOcean Spaces is now supported
90
+ * New: Plugin name updated from WP Offload S3 Lite to WP Offload Media Lite
91
+ * Improvement: More logical UI layout and better description of each setting
92
+
93
### WP Offload S3 Lite 1.4.3 - 2018-08-02 ###
94
* Bug fix: Images remotely edited via stream wrapper sometimes set as private on S3
95
assets/css/attachment.css CHANGED
@@ -1 +1 @@
1
- #s3-actions.postbox .inside{margin:0;padding:0}#s3-actions.postbox a,#s3-actions.postbox a:hover{text-decoration:none}#s3-actions.postbox .s3-details{padding:6px 0}#s3-actions.postbox .s3-details .misc-pub-section{clear:both;float:left;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}#s3-actions.postbox .s3-details .misc-pub-section .s3-key{float:left;width:20%}#s3-actions.postbox .s3-details .misc-pub-section .s3-value{font-weight:bold;float:left;width:80%}#s3-actions.postbox .s3-details .not-copied{color:#666666}#s3-actions.postbox .s3-actions{padding:10px;clear:both;border-top:1px solid #ddd;border-bottom:1px solid #ddd;background:#f5f5f5}#s3-actions.postbox .s3-actions .copy-action{text-align:right;float:right;line-height:23px}#s3-actions.postbox .s3-actions .remove-action{line-height:28px;vertical-align:middle;text-align:left;float:left}#s3-actions.postbox .s3-actions .remove-action a.local-warning{color:#a00}#s3-actions.postbox .s3-actions .remove-action a.local-warning:hover{color:#f00}
1
+ #s3-actions.postbox .inside{margin:0;padding:0}#s3-actions.postbox a,#s3-actions.postbox a:hover{text-decoration:none}#s3-actions.postbox .s3-details{padding:6px 0}#s3-actions.postbox .s3-details .misc-pub-section{clear:both;float:left;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}#s3-actions.postbox .s3-details .misc-pub-section .s3-key{float:left;width:20%;white-space:nowrap}#s3-actions.postbox .s3-details .misc-pub-section .s3-value{font-weight:bold;float:left;width:80%}#s3-actions.postbox .s3-details .misc-pub-section input.error{color:#a00}#s3-actions.postbox .s3-details .not-copied{color:#666}#s3-actions.postbox .s3-actions{padding:10px;clear:both;border-top:1px solid #ddd;border-bottom:1px solid #ddd;background:#f5f5f5}#s3-actions.postbox .s3-actions .copy-action{text-align:right;float:right;line-height:23px}#s3-actions.postbox .s3-actions .remove-action{line-height:28px;vertical-align:middle;text-align:left;float:left}#s3-actions.postbox .s3-actions .remove-action a.local-warning{color:#a00}#s3-actions.postbox .s3-actions .remove-action a.local-warning:hover{color:#f00}
assets/css/notice.css CHANGED
@@ -1 +1 @@
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}
1
+ .as3cf-notice p,.as3cf-compatibility-notice p{max-width:800px}.as3cf-licence-notice p:not(.as3cf-before):before{display:none}.as3cf-notice-warning{border-left-color:#ffba00}
assets/css/storage-provider.css ADDED
@@ -0,0 +1 @@
1
+ .as3cf-provider-select h3{font-size:20px}.as3cf-provider-select table{border-collapse:collapse}.as3cf-provider-select .as3cf-provider-title{margin:0;padding:0;background:#f1f1f1}.as3cf-provider-select .as3cf-provider-title label{position:relative;display:inline-block}.as3cf-provider-select .as3cf-provider-title label:hover{cursor:pointer}.as3cf-provider-select .as3cf-provider-title .as3cf-provider-logo{color:white;padding:1em}.as3cf-provider-select .as3cf-provider-title h3{display:inline-block;position:absolute;top:50%;left:76px;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);font-weight:bold;text-transform:none;padding:0;margin:0 15px;white-space:nowrap}.as3cf-provider-select .as3cf-provider-title.as3cf-provider-selected{cursor:default}.as3cf-provider-select .as3cf-provider-title.as3cf-provider-aws .as3cf-provider-logo{background-color:#f7a80d}.as3cf-provider-select .as3cf-provider-title.as3cf-provider-do .as3cf-provider-logo{background-color:#0080ff}.as3cf-provider-select .as3cf-provider-content td{padding-bottom:10px}.as3cf-provider-select .as3cf-provider-content table{background:#e5e5e5}.as3cf-provider-select .as3cf-provider-content table th{padding:10px 0 10px 10px}.as3cf-provider-select .as3cf-provider-content table td{padding:10px}.as3cf-provider-select .as3cf-provider-content .asc3f-provider-authmethod-title label{font-weight:bold}.as3cf-provider-select .as3cf-provider-content .asc3f-provider-authmethod-content td{padding-top:0}.as3cf-provider-select .as3cf-provider-content .asc3f-provider-authmethod-content textarea.as3cf-define-snippet.code{width:100%;white-space:pre;overflow:hidden;font-size:11px;padding:10px;margin-top:10px}.as3cf-provider-select .as3cf-provider-content .asc3f-provider-authmethod-content table.as3cf-access-keys{margin-top:10px}.as3cf-provider-select .as3cf-provider-content .asc3f-provider-authmethod-content table.as3cf-access-keys th{padding-left:0}.as3cf-provider-select .as3cf-provider-content .asc3f-provider-authmethod-content table.as3cf-access-keys input{width:100%}
assets/css/styles.css CHANGED
@@ -1 +1 @@
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}
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-main-settings .as3cf-provider-select{display:none}.as3cf-tab .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab .as3cf-bucket-container{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-can-write-error,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-can-write-error{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings{display:block}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-provider-select,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-provider-select{display:block}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-media-settings,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-bucket-container,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-bucket-container{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-main-settings{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-media-settings{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .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.configure-url:first-child td{padding-top:5px;padding-bottom:0}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px;padding-top:20px}.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 h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-region{font-style:italic}.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-provider-setting td{padding-top:20px;padding-bottom:5px}#tab-media .as3cf-bucket-setting td{padding:5px 0}.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 .as3cf-provider-setting h4{font-weight:inherit;margin:0}.as3cf-bucket-container .form-table .as3cf-bucket-list{margin:5px 0 0 0}.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-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-active-provider,.as3cf-active-bucket{font-weight:bold;margin-right:10px}.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-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/do-logo.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50">
2
+ <g fill="#FFFFFF" fill-rule="evenodd">
3
+ <path d="M24.9153 50v-9.661c10.226 0 18.1638-10.1413 14.2372-20.904-1.4406-3.983-4.6327-7.1751-8.6158-8.6158C19.774 6.921 9.6327 14.8305 9.6327 25.0565H0C0 8.7571 15.7627-3.9548 32.8531 1.3842c7.4576 2.3446 13.418 8.2768 15.7345 15.7344C53.9266 34.2373 41.2429 50 24.9153 50"></path>
4
+ <path d="M15.339 40.3672h9.6045v-9.6045H15.339zM7.9379 47.7684h7.401v-7.4012H7.938zM1.7514 40.3672H7.938v-6.1864H1.7514z"></path>
5
+ </g>
6
+ </svg>
assets/js/media.js CHANGED
@@ -1,6 +1,6 @@
1
var test = {};
2
3
- (function( $, _ ) {
4
5
// Local reference to the WordPress media namespace.
6
var media = wp.media;
@@ -26,9 +26,9 @@ var test = {};
26
},
27
28
fetchS3Details: function( id ) {
29
- wp.ajax.send( 'as3cf_get_attachment_s3_details', {
30
data: {
31
- _nonce: as3cf_media.nonces.get_attachment_s3_details,
32
id: id
33
}
34
} ).done( _.bind( this.renderView, this ) );
@@ -59,11 +59,11 @@ var test = {};
59
},
60
61
renderS3Details: function( response ) {
62
- if ( ! response || ! response.s3object ) {
63
return;
64
}
65
var $detailsHtml = this.$el.find( '.attachment-info .details' );
66
- var html = this.generateDetails( response, [ 'bucket', 'key', 'region', 'acl' ] );
67
$detailsHtml.append( html );
68
},
69
@@ -72,18 +72,18 @@ var test = {};
72
var template = _.template( '<div class="<%= key %>"><strong><%= label %>:</strong> <%= value %></div>' );
73
74
_( keys ).each( function( key ) {
75
- if ( response.s3object[ key ] ) {
76
- var value = response.s3object[ key ];
77
78
if ( 'acl' === key ) {
79
- value = response.s3object[ key ]['name'];
80
81
if ( response.acl_toggle ) {
82
var acl_template = _.template( '<a href="#" id="as3cfpro-toggle-acl" title="<%= title %>" data-currentACL="<%= acl %>"><%= value %></a>' );
83
84
value = acl_template( {
85
- title: response.s3object[ key ][ 'title' ],
86
- acl: response.s3object[ key ][ 'acl' ],
87
value: value
88
} );
89
}
@@ -123,12 +123,12 @@ var test = {};
123
}
124
125
wp.ajax.send( 'as3cfpro_update_acl', {
126
- data: {
127
- _ajax_nonce: as3cfpro_media.nonces.singular_update_acl,
128
- id: this.model.get( 'id' ),
129
- acl: newACL
130
- }
131
- } )
132
.done( _.bind( this.updateACL, this ) )
133
.fail( _.bind( this.renderACLError, this ) );
134
},
@@ -160,4 +160,4 @@ var test = {};
160
}
161
} );
162
163
- })( jQuery, _ );
1
var test = {};
2
3
+ ( function( $, _ ) {
4
5
// Local reference to the WordPress media namespace.
6
var media = wp.media;
26
},
27
28
fetchS3Details: function( id ) {
29
+ wp.ajax.send( 'as3cf_get_attachment_provider_details', {
30
data: {
31
+ _nonce: as3cf_media.nonces.get_attachment_provider_details,
32
id: id
33
}
34
} ).done( _.bind( this.renderView, this ) );
59
},
60
61
renderS3Details: function( response ) {
62
+ if ( ! response || ! response.provider_object ) {
63
return;
64
}
65
var $detailsHtml = this.$el.find( '.attachment-info .details' );
66
+ var html = this.generateDetails( response, [ 'provider_name', 'region', 'bucket', 'key', 'acl' ] );
67
$detailsHtml.append( html );
68
},
69
72
var template = _.template( '<div class="<%= key %>"><strong><%= label %>:</strong> <%= value %></div>' );
73
74
_( keys ).each( function( key ) {
75
+ if ( response.provider_object[ key ] ) {
76
+ var value = response.provider_object[ key ];
77
78
if ( 'acl' === key ) {
79
+ value = response.provider_object[ key ][ 'name' ];
80
81
if ( response.acl_toggle ) {
82
var acl_template = _.template( '<a href="#" id="as3cfpro-toggle-acl" title="<%= title %>" data-currentACL="<%= acl %>"><%= value %></a>' );
83
84
value = acl_template( {
85
+ title: response.provider_object[ key ][ 'title' ],
86
+ acl: response.provider_object[ key ][ 'acl' ],
87
value: value
88
} );
89
}
123
}
124
125
wp.ajax.send( 'as3cfpro_update_acl', {
126
+ data: {
127
+ _ajax_nonce: as3cfpro_media.nonces.singular_update_acl,
128
+ id: this.model.get( 'id' ),
129
+ acl: newACL
130
+ }
131
+ } )
132
.done( _.bind( this.updateACL, this ) )
133
.fail( _.bind( this.renderACLError, this ) );
134
},
160
}
161
} );
162
163
+ } )( jQuery, _ );
assets/js/media.min.js CHANGED
@@ -1 +1 @@
1
- var test={};!function(a,b){var c=wp.media,d=c.view.Attachment.Details.TwoColumn;c.view.Attachment.Details.TwoColumn=d.extend({events:function(){return b.extend({},d.prototype.events,{"click .local-warning":"confirmS3Removal","click #as3cfpro-toggle-acl":"toggleACL"})},render:function(){this.fetchS3Details(this.model.get("id"))},fetchS3Details:function(a){wp.ajax.send("as3cf_get_attachment_s3_details",{data:{_nonce:as3cf_media.nonces.get_attachment_s3_details,id:a}}).done(b.bind(this.renderView,this))},renderView:function(a){d.prototype.render.apply(this),this.renderActionLinks(a),this.renderS3Details(a)},renderActionLinks:function(c){var d=c&&c.links||[],e=this.$el.find(".actions"),f=a("<div />",{"class":"s3-actions"}),g=[];b(d).each(function(a){g.push(a)}),f.append(g.join(" | ")),e.append(f)},renderS3Details:function(a){if(a&&a.s3object){var b=this.$el.find(".attachment-info .details"),c=this.generateDetails(a,["bucket","key","region","acl"]);b.append(c)}},generateDetails:function(a,c){var d="",e=b.template('<div class="<%= key %>"><strong><%= label %>:</strong> <%= value %></div>');return b(c).each(function(c){if(a.s3object[c]){var f=a.s3object[c];if("acl"===c&&(f=a.s3object[c].name,a.acl_toggle)){var g=b.template('<a href="#" id="as3cfpro-toggle-acl" title="<%= title %>" data-currentACL="<%= acl %>"><%= value %></a>');f=g({title:a.s3object[c].title,acl:a.s3object[c].acl,value:f})}d+=e({key:c,label:as3cf_media.strings[c],value:f})}}),d},confirmS3Removal:function(a){if(!confirm(as3cfpro_media.strings.local_warning))return a.preventDefault(),a.stopImmediatePropagation(),!1},toggleACL:function(c){c.preventDefault();var d=a("#as3cfpro-toggle-acl"),e=d.data("currentacl"),f=as3cfpro_media.settings.private_acl;d.hide(),d.after('<span id="as3cfpro-updating">'+as3cfpro_media.strings.updating_acl+"</span>"),e===as3cfpro_media.settings.private_acl&&(f=as3cfpro_media.settings.default_acl),wp.ajax.send("as3cfpro_update_acl",{data:{_ajax_nonce:as3cfpro_media.nonces.singular_update_acl,id:this.model.get("id"),acl:f}}).done(b.bind(this.updateACL,this)).fail(b.bind(this.renderACLError,this))},renderACLError:function(){a("#as3cfpro-updating").remove(),a("#as3cfpro-toggle-acl").show(),alert(as3cfpro_media.strings.change_acl_error)},updateACL:function(b){if(null==b.acl_display||null==b.title||null==b.acl||null==b.url)return void this.renderACLError();this.model.set("url",b.url),this.render();var c=a("#as3cfpro-toggle-acl");a("#as3cfpro-updating").remove(),c.text(b.acl_display),c.attr("title",b.title),c.data("currentacl",b.acl),c.show()}})}(jQuery,_);
1
+ var test={};!function(a,b){var c=wp.media,d=c.view.Attachment.Details.TwoColumn;c.view.Attachment.Details.TwoColumn=d.extend({events:function(){return b.extend({},d.prototype.events,{"click .local-warning":"confirmS3Removal","click #as3cfpro-toggle-acl":"toggleACL"})},render:function(){this.fetchS3Details(this.model.get("id"))},fetchS3Details:function(a){wp.ajax.send("as3cf_get_attachment_provider_details",{data:{_nonce:as3cf_media.nonces.get_attachment_provider_details,id:a}}).done(b.bind(this.renderView,this))},renderView:function(a){d.prototype.render.apply(this),this.renderActionLinks(a),this.renderS3Details(a)},renderActionLinks:function(c){var d=c&&c.links||[],e=this.$el.find(".actions"),f=a("<div />",{"class":"s3-actions"}),g=[];b(d).each(function(a){g.push(a)}),f.append(g.join(" | ")),e.append(f)},renderS3Details:function(a){if(a&&a.provider_object){var b=this.$el.find(".attachment-info .details"),c=this.generateDetails(a,["provider_name","region","bucket","key","acl"]);b.append(c)}},generateDetails:function(a,c){var d="",e=b.template('<div class="<%= key %>"><strong><%= label %>:</strong> <%= value %></div>');return b(c).each(function(c){if(a.provider_object[c]){var f=a.provider_object[c];if("acl"===c&&(f=a.provider_object[c].name,a.acl_toggle)){var g=b.template('<a href="#" id="as3cfpro-toggle-acl" title="<%= title %>" data-currentACL="<%= acl %>"><%= value %></a>');f=g({title:a.provider_object[c].title,acl:a.provider_object[c].acl,value:f})}d+=e({key:c,label:as3cf_media.strings[c],value:f})}}),d},confirmS3Removal:function(a){if(!confirm(as3cfpro_media.strings.local_warning))return a.preventDefault(),a.stopImmediatePropagation(),!1},toggleACL:function(c){c.preventDefault();var d=a("#as3cfpro-toggle-acl"),e=d.data("currentacl"),f=as3cfpro_media.settings.private_acl;d.hide(),d.after('<span id="as3cfpro-updating">'+as3cfpro_media.strings.updating_acl+"</span>"),e===as3cfpro_media.settings.private_acl&&(f=as3cfpro_media.settings.default_acl),wp.ajax.send("as3cfpro_update_acl",{data:{_ajax_nonce:as3cfpro_media.nonces.singular_update_acl,id:this.model.get("id"),acl:f}}).done(b.bind(this.updateACL,this)).fail(b.bind(this.renderACLError,this))},renderACLError:function(){a("#as3cfpro-updating").remove(),a("#as3cfpro-toggle-acl").show(),alert(as3cfpro_media.strings.change_acl_error)},updateACL:function(b){if(null==b.acl_display||null==b.title||null==b.acl||null==b.url)return void this.renderACLError();this.model.set("url",b.url),this.render();var c=a("#as3cfpro-toggle-acl");a("#as3cfpro-updating").remove(),c.text(b.acl_display),c.attr("title",b.title),c.data("currentacl",b.acl),c.show()}})}(jQuery,_);
assets/js/modal.js CHANGED
@@ -140,6 +140,10 @@ var as3cfModal = (function( $ ) {
140
} );
141
142
$( 'body' ).on( 'click', '#as3cf-overlay, .close-as3cf-modal', function( e ) {
143
e.preventDefault();
144
145
// Don't allow children to bubble up click event
140
} );
141
142
$( 'body' ).on( 'click', '#as3cf-overlay, .close-as3cf-modal', function( e ) {
143
+ if ( 'A' === e.target.tagName ) {
144
+ return;
145
+ }
146
+
147
e.preventDefault();
148
149
// Don't allow children to bubble up click event
assets/js/modal.min.js CHANGED
@@ -1 +1 @@
1
- var as3cfModal=function(a){function b(a){return a.replace(/[^a-z]/g,"")}var c={prefix:"as3cf",loading:!1,dismissible:!0},d={};return c.exists=function(c){var e=b(c);return void 0!==d[e]||!!a(c).length},c.open=function(e,f,g){var h=b(e);a("body").append('<div id="as3cf-overlay"></div>');var i=a("#as3cf-overlay");c.dismissible?i.append('<div id="as3cf-modal"><span class="close-as3cf-modal">×</span></div>'):i.append('<div id="as3cf-modal"></div>');var j=a("#as3cf-modal");if(void 0===d[h]){var k=a(e);d[h]=k.clone(!0).css("display","block"),k.remove()}j.data("as3cf-modal-target",e).append(d[h]),void 0!==g&&j.addClass(g),"function"==typeof f&&f(e),a("body").addClass("as3cf-modal-open"),i.fadeIn(150),j.fadeIn(150),a("body").trigger("as3cf-modal-open",[e])},c.close=function(b){if(!c.loading&&c.dismissible){var d=a("#as3cf-modal").data("as3cf-modal-target");a("#as3cf-overlay").fadeOut(150,function(){a("body").removeClass("as3cf-modal-open"),a(this).remove(),"function"==typeof b&&b(d)}),a("body").trigger("as3cf-modal-close",[d])}},c.setLoadingState=function(a){c.loading=a},c.setDismissibleState=function(a){c.dismissible=a},a(document).ready(function(){a("body").on("click","[data-as3cf-modal]",function(b){b.preventDefault(),c.open(a(this).data("as3cf-modal")+"."+c.prefix)}),a("body").on("click","#as3cf-overlay, .close-as3cf-modal",function(a){return a.preventDefault(),a.target===this&&void c.close()})}),c}(jQuery);
1
+ var as3cfModal=function(a){function b(a){return a.replace(/[^a-z]/g,"")}var c={prefix:"as3cf",loading:!1,dismissible:!0},d={};return c.exists=function(c){var e=b(c);return void 0!==d[e]||!!a(c).length},c.open=function(e,f,g){var h=b(e);a("body").append('<div id="as3cf-overlay"></div>');var i=a("#as3cf-overlay");c.dismissible?i.append('<div id="as3cf-modal"><span class="close-as3cf-modal">×</span></div>'):i.append('<div id="as3cf-modal"></div>');var j=a("#as3cf-modal");if(void 0===d[h]){var k=a(e);d[h]=k.clone(!0).css("display","block"),k.remove()}j.data("as3cf-modal-target",e).append(d[h]),void 0!==g&&j.addClass(g),"function"==typeof f&&f(e),a("body").addClass("as3cf-modal-open"),i.fadeIn(150),j.fadeIn(150),a("body").trigger("as3cf-modal-open",[e])},c.close=function(b){if(!c.loading&&c.dismissible){var d=a("#as3cf-modal").data("as3cf-modal-target");a("#as3cf-overlay").fadeOut(150,function(){a("body").removeClass("as3cf-modal-open"),a(this).remove(),"function"==typeof b&&b(d)}),a("body").trigger("as3cf-modal-close",[d])}},c.setLoadingState=function(a){c.loading=a},c.setDismissibleState=function(a){c.dismissible=a},a(document).ready(function(){a("body").on("click","[data-as3cf-modal]",function(b){b.preventDefault(),c.open(a(this).data("as3cf-modal")+"."+c.prefix)}),a("body").on("click","#as3cf-overlay, .close-as3cf-modal",function(a){if("A"!==a.target.tagName)return a.preventDefault(),a.target===this&&void c.close()})}),c}(jQuery);
assets/js/script.js CHANGED
@@ -1,4 +1,4 @@
1
- (function( $, as3cfModal ) {
2
3
var savedSettings = {};
4
var bucketNamePattern = /[^a-z0-9.-]/;
@@ -60,7 +60,7 @@
60
* Toggle settings tab
61
*
62
* @param string hash
63
- * @param bool persist_updated_notice
64
*/
65
toggle: function( hash, persist_updated_notice ) {
66
hash = as3cf.tabs.sanitizeHash( hash );
@@ -151,14 +151,16 @@
151
/**
152
* Load bucket list
153
*
154
- * @param {bool} [forceUpdate]
155
*/
156
loadList: function( forceUpdate ) {
157
if ( 'undefined' === typeof forceUpdate ) {
158
forceUpdate = false;
159
}
160
161
- var $bucketList = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-list' );
162
var selectedBucket = $( '#' + as3cfModal.prefix + '-bucket' ).val();
163
164
if ( false === forceUpdate && $bucketList.find( 'li' ).length > 1 ) {
@@ -176,6 +178,10 @@
176
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.get_buckets
177
};
178
179
var that = this;
180
181
$.ajax( {
@@ -193,12 +199,16 @@
193
if ( 'undefined' !== typeof data[ 'success' ] ) {
194
$( '.as3cf-bucket-error' ).hide();
195
196
- $( data[ 'buckets' ] ).each( function( idx, bucket ) {
197
- var bucketClass = bucket.Name === selectedBucket ? 'selected' : '';
198
- $bucketList.append( '<li><a class="' + bucketClass + '" href="#" data-bucket="' + bucket.Name + '"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> ' + bucket.Name + '</span><span class="spinner"></span></span></a></li>' );
199
- } );
200
201
- that.scrollToSelected();
202
} else {
203
that.showError( as3cf.strings.get_buckets_error, data[ 'error' ], 'as3cf-bucket-select' );
204
}
@@ -254,6 +264,7 @@
254
*/
255
saveManual: function() {
256
var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
257
var $manualBucketInput = $manualBucketForm.find( '.as3cf-bucket-name' );
258
var $manualBucketButton = $manualBucketForm.find( 'button[type=submit]' );
259
var bucketName = $manualBucketInput.val();
@@ -275,6 +286,10 @@
275
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.manual_bucket
276
};
277
278
var that = this;
279
280
$.ajax( {
@@ -290,7 +305,7 @@
290
$manualBucketButton.text( originalBucketText );
291
$manualBucketButton.prop( 'disabled', false );
292
if ( 'undefined' !== typeof data[ 'success' ] ) {
293
- that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
294
$( '#' + as3cfModal.prefix + '-bucket-select' ).val( 'manual' );
295
$( '.as3cf-bucket-list a' ).removeClass( 'selected' ).filter( '[data-bucket="' + bucketName + '"]' ).addClass( 'selected' );
296
@@ -311,8 +326,6 @@
311
* @param {object} $link
312
*/
313
saveSelected: function( $link ) {
314
- var $bucketList = $( '.as3cf-bucket-list' );
315
-
316
if ( this.bucketSelectLock ) {
317
318
// Bail if a bucket has already been clicked
@@ -322,13 +335,17 @@
322
// Lock the bucket selection
323
this.bucketSelectLock = true;
324
325
if ( $link.hasClass( 'selected' ) ) {
326
$activeTab.addClass( 'as3cf-has-bucket' );
327
as3cfModal.close();
328
return;
329
}
330
331
- var previousBucket = $( '.as3cf-bucket-list a.selected' ).data( 'bucket' );
332
333
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
334
$link.addClass( 'selected' );
@@ -343,6 +360,10 @@
343
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.save_bucket
344
};
345
346
var that = this;
347
348
$.ajax( {
@@ -360,7 +381,7 @@
360
$link.find( '.spinner' ).hide().css( 'visibility', 'hidden' );
361
$bucketList.removeClass( 'saving' );
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();
@@ -427,10 +448,14 @@
427
*
428
* @param {string} bucket
429
* @param {string} region
430
- * @param {bool} canWrite
431
*/
432
- set: function( bucket, region, canWrite ) {
433
- var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
434
var $activeBucket = $( '#' + as3cfModal.prefix + '-active-bucket' );
435
436
if ( 'as3cf' === as3cfModal.prefix && 0 === $activeBucket.text().trim().length ) {
@@ -448,9 +473,15 @@
448
$( '.as3cf-error.fatal' ).hide();
449
450
$activeBucket.text( bucket );
451
- $manualBucketForm.find( '.as3cf-bucket-name' ).val( bucket );
452
$( '#' + as3cfModal.prefix + '-bucket' ).val( bucket );
453
$( '#' + as3cfModal.prefix + '-region' ).val( region );
454
$( '.updated' ).not( '.as3cf-notice' ).show();
455
456
$activeTab.addClass( 'as3cf-has-bucket' );
@@ -479,7 +510,7 @@
479
create: function() {
480
var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
481
var $createBucketInput = $createBucketForm.find( '.as3cf-bucket-name' );
482
- var $createBucketSelect = $createBucketForm.find( '.bucket-create-region' );
483
var $createBucketButton = $createBucketForm.find( 'button[type=submit]' );
484
485
var bucketName = $createBucketInput.val();
@@ -495,8 +526,8 @@
495
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.create_bucket
496
};
497
498
- if ( $createBucketSelect.val() ) {
499
- data[ 'region' ] = $createBucketSelect.val();
500
}
501
502
var that = this;
@@ -514,7 +545,7 @@
514
$createBucketButton.text( origButtonText );
515
$createBucketButton.prop( 'disabled', false );
516
if ( 'undefined' !== typeof data[ 'success' ] ) {
517
- that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
518
519
// Tidy up create bucket form
520
$( '.as3cf-bucket-select-region' ).hide();
@@ -541,7 +572,7 @@
541
*
542
* @param {string} bucketName
543
*
544
- * @return bool
545
*/
546
isValidName: function( bucketName ) {
547
if ( bucketName.length < 3 || bucketName.length > 63 ) {
@@ -619,10 +650,10 @@
619
var prefix = $objectPrefix.val();
620
621
if ( '' !== prefix ) {
622
- prefix = as3cf.aws_bucket_link_param + encodeURIComponent( prefix );
623
}
624
625
- var url = as3cf.aws_bucket_link + bucket + prefix;
626
627
$( '#' + as3cfModal.prefix + '-view-bucket' ).attr( 'href', url );
628
}
@@ -658,6 +689,7 @@
658
success: function( data, textStatus, jqXHR ) {
659
if ( 'undefined' !== typeof data[ 'success' ] ) {
660
$( '.as3cf-url-preview' ).html( data[ 'url' ] );
661
} else {
662
alert( as3cf.strings.get_url_preview_error + data[ 'error' ] );
663
}
@@ -687,6 +719,17 @@
687
}
688
}
689
690
/**
691
* Update the UI with the current active tab set in the URL hash.
692
*/
@@ -704,85 +747,6 @@
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
@@ -945,6 +909,12 @@
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();
@@ -1000,22 +970,6 @@
1000
$manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
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 );
1
+ ( function( $, as3cfModal ) {
2
3
var savedSettings = {};
4
var bucketNamePattern = /[^a-z0-9.-]/;
60
* Toggle settings tab
61
*
62
* @param string hash
63
+ * @param boolean persist_updated_notice
64
*/
65
toggle: function( hash, persist_updated_notice ) {
66
hash = as3cf.tabs.sanitizeHash( hash );
151
/**
152
* Load bucket list
153
*
154
+ * @param {boolean} [forceUpdate]
155
*/
156
loadList: function( forceUpdate ) {
157
if ( 'undefined' === typeof forceUpdate ) {
158
forceUpdate = false;
159
}
160
161
+ var $selectBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' );
162
+ var $selectBucketRegion = $selectBucketForm.find( '.bucket-select-region' );
163
+ var $bucketList = $selectBucketForm.find( '.as3cf-bucket-list' );
164
var selectedBucket = $( '#' + as3cfModal.prefix + '-bucket' ).val();
165
166
if ( false === forceUpdate && $bucketList.find( 'li' ).length > 1 ) {
178
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.get_buckets
179
};
180
181
+ if ( $selectBucketRegion.val() ) {
182
+ data[ 'region' ] = $selectBucketRegion.val();
183
+ }
184
+
185
var that = this;
186
187
$.ajax( {
199
if ( 'undefined' !== typeof data[ 'success' ] ) {
200
$( '.as3cf-bucket-error' ).hide();
201
202
+ if ( 0 === data['buckets'].length ) {
203
+ $bucketList.html( '<li class="loading">' + $bucketList.data( 'nothing-found' ) + '</li>' );
204
+ } else {
205
+ $( data[ 'buckets' ] ).each( function( idx, bucket ) {
206
+ var bucketClass = bucket.Name === selectedBucket ? 'selected' : '';
207
+ $bucketList.append( '<li><a class="' + bucketClass + '" href="#" data-bucket="' + bucket.Name + '"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> ' + bucket.Name + '</span><span class="spinner"></span></span></a></li>' );
208
+ } );
209
210
+ that.scrollToSelected();
211
+ }
212
} else {
213
that.showError( as3cf.strings.get_buckets_error, data[ 'error' ], 'as3cf-bucket-select' );
214
}
264
*/
265
saveManual: function() {
266
var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
267
+ var $manualBucketRegion = $manualBucketForm.find( '.bucket-manual-region' );
268
var $manualBucketInput = $manualBucketForm.find( '.as3cf-bucket-name' );
269
var $manualBucketButton = $manualBucketForm.find( 'button[type=submit]' );
270
var bucketName = $manualBucketInput.val();
286
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.manual_bucket
287
};
288
289
+ if ( $manualBucketRegion.val() ) {
290
+ data[ 'region' ] = $manualBucketRegion.val();
291
+ }
292
+
293
var that = this;
294
295
$.ajax( {
305
$manualBucketButton.text( originalBucketText );
306
$manualBucketButton.prop( 'disabled', false );
307
if ( 'undefined' !== typeof data[ 'success' ] ) {
308
+ that.set( bucketName, data[ 'region' ], data['region_name'], data[ 'can_write' ] );
309
$( '#' + as3cfModal.prefix + '-bucket-select' ).val( 'manual' );
310
$( '.as3cf-bucket-list a' ).removeClass( 'selected' ).filter( '[data-bucket="' + bucketName + '"]' ).addClass( 'selected' );
311
326
* @param {object} $link
327
*/
328
saveSelected: function( $link ) {
329
if ( this.bucketSelectLock ) {
330
331
// Bail if a bucket has already been clicked
335
// Lock the bucket selection
336
this.bucketSelectLock = true;
337
338
+ var $selectBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' );
339
+ var $selectBucketRegion = $selectBucketForm.find( '.bucket-select-region' );
340
+ var $bucketList = $selectBucketForm.find( '.as3cf-bucket-list' );
341
+
342
if ( $link.hasClass( 'selected' ) ) {
343
$activeTab.addClass( 'as3cf-has-bucket' );
344
as3cfModal.close();
345
return;
346
}
347
348
+ var previousBucket = $selectBucketForm.find( '.as3cf-bucket-list a.selected' ).data( 'bucket' );
349
350
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
351
$link.addClass( 'selected' );
360
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.save_bucket
361
};
362
363
+ if ( $selectBucketRegion.val() ) {
364
+ data[ 'region' ] = $selectBucketRegion.val();
365
+ }
366
+
367
var that = this;
368
369
$.ajax( {
381
$link.find( '.spinner' ).hide().css( 'visibility', 'hidden' );
382
$bucketList.removeClass( 'saving' );
383
if ( 'undefined' !== typeof data[ 'success' ] ) {
384
+ that.set( bucketName, data[ 'region' ], data['region_name'], data[ 'can_write' ] );
385
$( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );
386
387
as3cf.showSettingsSavedNotice();
448
*
449
* @param {string} bucket
450
* @param {string} region
451
+ * @param {string} region_name
452
+ * @param {boolean} canWrite
453
*/
454
+ set: function( bucket, region, region_name, canWrite ) {
455
+ var $manualBucket = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' );
456
+ var $selectBucket = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' );
457
+ var $createBucket = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' );
458
+ var $activeRegion = $( '#' + as3cfModal.prefix + '-active-region' );
459
var $activeBucket = $( '#' + as3cfModal.prefix + '-active-bucket' );
460
461
if ( 'as3cf' === as3cfModal.prefix && 0 === $activeBucket.text().trim().length ) {
473
$( '.as3cf-error.fatal' ).hide();
474
475
$activeBucket.text( bucket );
476
+ $manualBucket.find( '.as3cf-bucket-name' ).val( bucket );
477
$( '#' + as3cfModal.prefix + '-bucket' ).val( bucket );
478
+
479
+ $activeRegion.text( region_name );
480
+ $manualBucket.find( '.bucket-manual-region' ).val( region );
481
+ $selectBucket.find( '.bucket-select-region' ).val( region );
482
+ $createBucket.find( '.bucket-create-region' ).val( region );
483
$( '#' + as3cfModal.prefix + '-region' ).val( region );
484
+
485
$( '.updated' ).not( '.as3cf-notice' ).show();
486
487
$activeTab.addClass( 'as3cf-has-bucket' );
510
create: function() {
511
var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
512
var $createBucketInput = $createBucketForm.find( '.as3cf-bucket-name' );
513
+ var $createBucketRegion = $createBucketForm.find( '.bucket-create-region' );
514
var $createBucketButton = $createBucketForm.find( 'button[type=submit]' );
515
516
var bucketName = $createBucketInput.val();
526
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.create_bucket
527
};
528
529
+ if ( $createBucketRegion.val() ) {
530
+ data[ 'region' ] = $createBucketRegion.val();
531
}
532
533
var that = this;
545
$createBucketButton.text( origButtonText );
546
$createBucketButton.prop( 'disabled', false );
547
if ( 'undefined' !== typeof data[ 'success' ] ) {
548
+ that.set( bucketName, data[ 'region' ], data['region_name'], data[ 'can_write' ] );
549
550
// Tidy up create bucket form
551
$( '.as3cf-bucket-select-region' ).hide();
572
*
573
* @param {string} bucketName
574
*
575
+ * @return boolean
576
*/
577
isValidName: function( bucketName ) {
578
if ( bucketName.length < 3 || bucketName.length > 63 ) {
650
var prefix = $objectPrefix.val();
651
652
if ( '' !== prefix ) {
653
+ prefix = as3cf.provider_console_url_param + encodeURIComponent( prefix );
654
}
655
656
+ var url = as3cf.provider_console_url + bucket + prefix;
657
658
$( '#' + as3cfModal.prefix + '-view-bucket' ).attr( 'href', url );
659
}
689
success: function( data, textStatus, jqXHR ) {
690
if ( 'undefined' !== typeof data[ 'success' ] ) {
691
$( '.as3cf-url-preview' ).html( data[ 'url' ] );
692
+ toggleSEOFriendlyURLNotice( data[ 'seo_friendly' ] );
693
} else {
694
alert( as3cf.strings.get_url_preview_error + data[ 'error' ] );
695
}
719
}
720
}
721
722
+ /*
723
+ * Toggle the seo friendly url notice.
724
+ */
725
+ function toggleSEOFriendlyURLNotice( seo_friendly ) {
726
+ if ( true !== seo_friendly ) {
727
+ $( '#as3cf-seo-friendly-url-notice' ).show();
728
+ } else {
729
+ $( '#as3cf-seo-friendly-url-notice' ).hide();
730
+ }
731
+ }
732
+
733
/**
734
* Update the UI with the current active tab set in the URL hash.
735
*/
747
$( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] );
748
}
749
750
$( document ).ready( function() {
751
752
// Tabs
909
as3cf.buckets.loadList( true );
910
} );
911
912
+ // Bucket list refresh on region change handler
913
+ $body.on( 'change', '.bucket-select-region', function( e ) {
914
+ e.preventDefault();
915
+ as3cf.buckets.loadList( true );
916
+ } );
917
+
918
// Bucket list click handler
919
$body.on( 'click', '.as3cf-bucket-list a', function( e ) {
920
e.preventDefault();
970
$manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
971
}
972
} );
973
} );
974
975
+ } )( 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=as3cf.aws_bucket_link_param+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);
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=l.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("#"+l.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=l.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e=as3cf.provider_console_url_param+encodeURIComponent(e));var f=as3cf.provider_console_url+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),j(b.seo_friendly)):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(b){!0!==b?a("#as3cf-seo-friendly-url-notice").show():a("#as3cf-seo-friendly-url-notice").hide()}function k(){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 l,m={},n=/[^a-z0-9.-]/,o=!1,p=a("body"),q=a(".as3cf-tab");a(".as3cf-settings");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),q.hide(),l=a("#tab-"+c),l.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),l.data("prefix")&&(b.prefix=l.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-select"),e=d.find(".bucket-select-region"),f=d.find(".as3cf-bucket-list"),g=a("#"+b.prefix+"-bucket").val();if(!1===c&&f.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').addClass("selected"),void this.scrollToSelected();f.html('<li class="loading">'+f.data("working")+"</li>");var h={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets};e.val()&&(h.region=e.val());var i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){f.html(""),i.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,d){f.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),0===b.buckets.length?f.html('<li class="loading">'+f.data("nothing-found")+"</li>"):(a(b.buckets).each(function(a,b){var c=b.Name===g?"selected":"";f.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>')}),i.scrollToSelected())):i.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===l.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(o),o=!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(".bucket-manual-region"),e=c.find(".as3cf-bucket-name"),f=c.find("button[type=submit]"),g=e.val(),h=f.first().text();if(g===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),l.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-manual-save-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket};d.val()&&(i.region=d.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.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof c.success?(j.set(g,c.region,c.region_name,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+g+'"]').addClass("selected"),o=!0,as3cf.showSettingsSavedNotice()):j.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){if(!this.bucketSelectLock){this.bucketSelectLock=!0;var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select"),e=d.find(".bucket-select-region"),f=d.find(".as3cf-bucket-list");if(c.hasClass("selected"))return l.addClass("as3cf-has-bucket"),void b.close();var g=d.find(".as3cf-bucket-list a.selected").data("bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),f.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var h=c.data("bucket"),i={action:b.prefix+"-save-bucket",bucket_name:h,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(b,c,d){f.removeClass("saving"),j.showError(as3cf.strings.save_bucket_error,d,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').addClass("selected")},success:function(d,e,i){c.find(".spinner").hide().css("visibility","hidden"),f.removeClass("saving"),"undefined"!=typeof d.success?(j.set(h,d.region,d.region_name,d.can_write),a("#"+b.prefix+"-bucket-select").val(""),as3cf.showSettingsSavedNotice()):(j.showError(as3cf.strings.save_bucket_error,d.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').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,j){var k=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual"),n=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select"),o=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create"),p=a("#"+b.prefix+"-active-region"),q=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===q.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var r=l.attr("id");m[r]=c(r)}a(".as3cf-error.fatal").hide(),q.text(e),k.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),p.text(i),k.find(".bucket-manual-region").val(h),n.find(".bucket-select-region").val(h),o.find(".bucket-create-region").val(h),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),l.addClass("as3cf-has-bucket"),l.find(".as3cf-can-write-error").toggle(!j),l.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){l.trigger("bucket-change",[j]),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.region_name,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").prop("selected",!1),d.val(""),f.prop("disabled",!0),o=!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!==n.test(a)},updateNameNotice:function(b){var c=null;!0===n.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")}},a(document).ready(function(){k(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),k()};var j=a(".as3cf-main .nav-tab-wrapper");a(".as3cf-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(j),q.length&&q.each(function(a,b){m[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(m)){var b=l.attr("id");return c(b)!==m[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"))}),q.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("#"+l.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"),p.on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),p.on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(o),o=!1}),p.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()}),p.on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),p.on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),p.on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),p.on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),p.on("change",".bucket-select-region",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),p.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}),p.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(),p.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)}),p.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);
assets/js/storage-provider.js ADDED
@@ -0,0 +1,85 @@
1
+ ( function( $ ) {
2
+ var $body = $( 'body' );
3
+
4
+ var as3cf = as3cf || {};
5
+
6
+ /**
7
+ * Handle changes to the selected Storage Provider and Access Key saving.
8
+ */
9
+ as3cf.storageProvider = {
10
+ changed: function() {
11
+ var provider = $( 'input[name="provider"]:checked' ).val();
12
+
13
+ // Hide and disable all providers.
14
+ $( '.as3cf-provider-content' ).each( function() {
15
+ as3cf.storageProvider.disableContent( this );
16
+ } );
17
+
18
+ // Show and enable selected provider.
19
+ $( '.as3cf-provider-content[data-provider="' + provider + '"]' ).each( function() {
20
+ as3cf.storageProvider.enableContent( this );
21
+ } );
22
+ },
23
+
24
+ disableContent: function( element ) {
25
+ $( element ).hide();
26
+ $( element ).removeClass( 'as3cf-provider-selected' );
27
+ $( element ).find( 'input' ).prop( 'disabled', true );
28
+ },
29
+
30
+ enableContent: function( element ) {
31
+ $( element ).find( 'input:not( [data-as3cf-disabled="true"] )' ).prop( 'disabled', false );
32
+ $( element ).addClass( 'as3cf-provider-selected' );
33
+ $( element ).show( 'fast', function() {
34
+ as3cf.storageProvider.setSelectedAuthMethod( this );
35
+ } );
36
+ },
37
+
38
+ setSelectedAuthMethod: function( element ) {
39
+ $( element ).find( 'input[name="authmethod"]:checked' ).prop( 'checked', true ).change();
40
+
41
+ // If exactly one auth method isn't selected, select the first.
42
+ var checkedCount = $( element ).find( 'input[name="authmethod"]:checked' ).length;
43
+
44
+ if ( 1 !== checkedCount ) {
45
+ $( element ).find( 'input[name="authmethod"]' ).first().prop( 'checked', true ).change();
46
+ }
47
+ },
48
+
49
+ authMethodChanged: function() {
50
+ var authMethod = $( 'input[name="authmethod"]:checked' ).val();
51
+
52
+ // Hide all auth methods.
53
+ $( '.asc3f-provider-authmethod-content' ).each( function() {
54
+ as3cf.storageProvider.disableAuthMethodContent( this );
55
+ } );
56
+
57
+ // Show selected auth method.
58
+ $( '.asc3f-provider-authmethod-content[data-provider-authmethod="' + authMethod + '"]' ).each( function() {
59
+ as3cf.storageProvider.enableAuthMethodContent( this );
60
+ } );
61
+ },
62
+
63
+ disableAuthMethodContent: function( element ) {
64
+ $( element ).hide();
65
+ },
66
+
67
+ enableAuthMethodContent: function( element ) {
68
+ $( element ).show();
69
+ }
70
+ };
71
+
72
+ $( document ).ready( function() {
73
+ // Switch displayed storage provider content.
74
+ $body.on( 'change', 'input[name="provider"]', function( e ) {
75
+ e.preventDefault();
76
+ as3cf.storageProvider.changed();
77
+ } );
78
+ // Switch displayed storage provider auth method content.
79
+ $body.on( 'change', 'input[name="authmethod"]', function( e ) {
80
+ e.preventDefault();
81
+ as3cf.storageProvider.authMethodChanged();
82
+ } );
83
+ } );
84
+
85
+ } )( jQuery );
assets/js/storage-provider.min.js ADDED
@@ -0,0 +1 @@
1
+ !function(a){var b=a("body"),c=c||{};c.storageProvider={changed:function(){var b=a('input[name="provider"]:checked').val();a(".as3cf-provider-content").each(function(){c.storageProvider.disableContent(this)}),a('.as3cf-provider-content[data-provider="'+b+'"]').each(function(){c.storageProvider.enableContent(this)})},disableContent:function(b){a(b).hide(),a(b).removeClass("as3cf-provider-selected"),a(b).find("input").prop("disabled",!0)},enableContent:function(b){a(b).find('input:not( [data-as3cf-disabled="true"] )').prop("disabled",!1),a(b).addClass("as3cf-provider-selected"),a(b).show("fast",function(){c.storageProvider.setSelectedAuthMethod(this)})},setSelectedAuthMethod:function(b){a(b).find('input[name="authmethod"]:checked').prop("checked",!0).change();var c=a(b).find('input[name="authmethod"]:checked').length;1!==c&&a(b).find('input[name="authmethod"]').first().prop("checked",!0).change()},authMethodChanged:function(){var b=a('input[name="authmethod"]:checked').val();a(".asc3f-provider-authmethod-content").each(function(){c.storageProvider.disableAuthMethodContent(this)}),a('.asc3f-provider-authmethod-content[data-provider-authmethod="'+b+'"]').each(function(){c.storageProvider.enableAuthMethodContent(this)})},disableAuthMethodContent:function(b){a(b).hide()},enableAuthMethodContent:function(b){a(b).show()}},a(document).ready(function(){b.on("change",'input[name="provider"]',function(a){a.preventDefault(),c.storageProvider.changed()}),b.on("change",'input[name="authmethod"]',function(a){a.preventDefault(),c.storageProvider.authMethodChanged()})})}(jQuery);
assets/sass/attachment.scss CHANGED
@@ -8,7 +8,7 @@
8
}
9
.s3-details {
10
padding: 6px 0;
11
-
12
.misc-pub-section {
13
clear: both;
14
float: left;
@@ -20,15 +20,19 @@
20
.s3-key {
21
float: left;
22
width: 20%;
23
}
24
.s3-value {
25
font-weight: bold;
26
float: left;
27
width: 80%;
28
}
29
}
30
.not-copied {
31
- color: #666666;
32
}
33
}
34
.s3-actions {
8
}
9
.s3-details {
10
padding: 6px 0;
11
+
12
.misc-pub-section {
13
clear: both;
14
float: left;
20
.s3-key {
21
float: left;
22
width: 20%;
23
+ white-space: nowrap;
24
}
25
.s3-value {
26
font-weight: bold;
27
float: left;
28
width: 80%;
29
}
30
+ input.error {
31
+ color: #a00;
32
+ }
33
}
34
.not-copied {
35
+ color: #666;
36
}
37
}
38
.s3-actions {
assets/sass/notice.scss CHANGED
@@ -11,7 +11,7 @@
11
/**
12
* Prevent WP from adding the circular arrow icon to all P tags inside the notice html.
13
*/
14
- .as3cf-license-notice p:not(.as3cf-before):before {
15
display: none;
16
}
17
11
/**
12
* Prevent WP from adding the circular arrow icon to all P tags inside the notice html.
13
*/
14
+ .as3cf-licence-notice p:not(.as3cf-before):before {
15
display: none;
16
}
17
assets/sass/storage-provider.scss ADDED
@@ -0,0 +1,112 @@
1
+ $aws_orange: #f7a80d;
2
+ $do_blue: #0080ff;
3
+
4
+ .as3cf-provider-select {
5
+ h3 {
6
+ font-size: 20px;
7
+ }
8
+
9
+ table {
10
+ border-collapse: collapse;
11
+ }
12
+
13
+ .as3cf-provider-title {
14
+ margin: 0;
15
+ padding: 0;
16
+ background: #f1f1f1;
17
+
18
+ label {
19
+ position: relative;
20
+ display: inline-block;
21
+
22
+ &:hover {
23
+ cursor: pointer;
24
+ }
25
+ }
26
+
27
+ .as3cf-provider-logo {
28
+ color: white;
29
+ padding: 1em;
30
+ }
31
+
32
+ h3 {
33
+ display: inline-block;
34
+ position: absolute;
35
+ top: 50%;
36
+ left: 76px;
37
+ transform: translateY(-50%);
38
+ font-weight: bold;
39
+ text-transform: none;
40
+ padding: 0;
41
+ margin: 0 15px;
42
+ white-space: nowrap;
43
+ }
44
+
45
+ &.as3cf-provider-selected {
46
+ cursor: default;
47
+ }
48
+
49
+ &.as3cf-provider-aws {
50
+ .as3cf-provider-logo {
51
+ background-color: $aws_orange;
52
+ }
53
+ }
54
+
55
+ &.as3cf-provider-do {
56
+ .as3cf-provider-logo {
57
+ background-color: $do_blue;
58
+ }
59
+ }
60
+ }
61
+
62
+ .as3cf-provider-content {
63
+ td {
64
+ padding-bottom: 10px;
65
+ }
66
+
67
+ table {
68
+ background: #e5e5e5;
69
+
70
+ th {
71
+ padding: 10px 0 10px 10px;
72
+ }
73
+
74
+ td {
75
+ padding: 10px;
76
+ }
77
+ }
78
+
79
+ .asc3f-provider-authmethod-title {
80
+ label {
81
+ font-weight: bold;
82
+ }
83
+ }
84
+
85
+ .asc3f-provider-authmethod-content {
86
+ td {
87
+ padding-top: 0;
88
+ }
89
+
90
+ textarea.as3cf-define-snippet.code {
91
+ width: 100%;
92
+ white-space: pre;
93
+ overflow: hidden;
94
+ font-size: 11px;
95
+ padding: 10px;
96
+ margin-top: 10px;
97
+ }
98
+
99
+ table.as3cf-access-keys {
100
+ margin-top: 10px;
101
+
102
+ th {
103
+ padding-left: 0;
104
+ }
105
+
106
+ input {
107
+ width: 100%;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
assets/sass/styles.scss CHANGED
@@ -1,4 +1,3 @@
1
- $aws_orange: #f7a80d;
2
$as3cf_assets: #0769ad;
3
4
.as3cf-content,
@@ -107,20 +106,76 @@ $as3cf_assets: #0769ad;
107
}
108
109
/**
110
- * Bucket select
111
*/
112
.as3cf-tab {
113
.as3cf-main-settings {
114
display: none;
115
}
116
117
.as3cf-bucket-container {
118
- display: block;
119
}
120
121
- &.as3cf-has-bucket {
122
.as3cf-main-settings {
123
display: block;
124
}
125
126
.as3cf-bucket-container {
@@ -294,11 +349,16 @@ $as3cf_assets: #0769ad;
294
&.as3cf-setting-title:first-child td {
295
padding-top: 20px;
296
}
297
td {
298
padding: 15px 0;
299
&:first-child {
300
vertical-align: top;
301
min-width: 120px;
302
}
303
304
.as3cf-notice:last-child {
@@ -311,10 +371,6 @@ $as3cf_assets: #0769ad;
311
}
312
}
313
314
- tr.as3cf-bucket-setting .as3cf-defined-in-config {
315
- float: none;
316
- }
317
-
318
h3 {
319
padding: 0;
320
margin: 0;
@@ -324,10 +380,10 @@ $as3cf_assets: #0769ad;
324
}
325
}
326
327
- .as3cf-active-bucket {
328
- font-weight: bold;
329
- margin-right: 10px;
330
}
331
.as3cf-view-bucket {
332
color: #444;
333
text-decoration: none;
@@ -439,26 +495,13 @@ $as3cf_assets: #0769ad;
439
#tab-media {
440
display: block;
441
442
- .as3cf-main-settings {
443
- display: none;
444
}
445
446
.as3cf-bucket-setting td {
447
- padding-top: 5px;
448
- }
449
-
450
- .as3cf-bucket-container {
451
- display: block;
452
- }
453
-
454
- &.as3cf-has-bucket {
455
- .as3cf-main-settings {
456
- display: block;
457
- }
458
-
459
- .as3cf-bucket-container {
460
- display: none;
461
- }
462
}
463
}
464
@@ -487,6 +530,15 @@ $as3cf_assets: #0769ad;
487
}
488
489
.form-table {
490
td {
491
padding: 5px 0;
492
@@ -571,43 +623,6 @@ $as3cf_assets: #0769ad;
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 {
@@ -765,6 +780,11 @@ $as3cf_assets: #0769ad;
765
/**
766
* Misc
767
*/
768
.as3cf-banner {
769
margin-top: 35px;
770
width: 292px;
@@ -861,12 +881,6 @@ $as3cf_assets: #0769ad;
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;
1
$as3cf_assets: #0769ad;
2
3
.as3cf-content,
106
}
107
108
/**
109
+ * Show Storage Provider / Bucket Select / media Settings
110
*/
111
.as3cf-tab {
112
.as3cf-main-settings {
113
display: none;
114
+
115
+ .as3cf-provider-select {
116
+ display: none;
117
+ }
118
+
119
+ .as3cf-media-settings {
120
+ display: none;
121
+ }
122
}
123
124
.as3cf-bucket-container {
125
+ display: none;
126
}
127
128
+ &.as3cf-needs-access-keys, &.as3cf-has-access-keys.as3cf-change-provider {
129
+ .as3cf-can-write-error {
130
+ display: none;
131
+ }
132
+
133
.as3cf-main-settings {
134
display: block;
135
+
136
+ .as3cf-provider-select {
137
+ display: block;
138
+ }
139
+
140
+ .as3cf-media-settings {
141
+ display: none;
142
+ }
143
+ }
144
+
145
+ .as3cf-bucket-container {
146
+ display: none;
147
+ }
148
+ }
149
+
150
+ &.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) {
151
+ .as3cf-main-settings {
152
+ display: none;
153
+
154
+ .as3cf-provider-select {
155
+ display: none;
156
+ }
157
+
158
+ .as3cf-media-settings {
159
+ display: none;
160
+ }
161
+ }
162
+
163
+ .as3cf-bucket-container {
164
+ display: block;
165
+ }
166
+ }
167
+
168
+ &.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) {
169
+ .as3cf-main-settings {
170
+ display: block;
171
+
172
+ .as3cf-provider-select {
173
+ display: none;
174
+ }
175
+
176
+ .as3cf-media-settings {
177
+ display: block;
178
+ }
179
}
180
181
.as3cf-bucket-container {
349
&.as3cf-setting-title:first-child td {
350
padding-top: 20px;
351
}
352
+ &.configure-url:first-child td {
353
+ padding-top: 5px;
354
+ padding-bottom: 0;
355
+ }
356
td {
357
padding: 15px 0;
358
&:first-child {
359
vertical-align: top;
360
min-width: 120px;
361
+ padding-top: 20px;
362
}
363
364
.as3cf-notice:last-child {
371
}
372
}
373
374
h3 {
375
padding: 0;
376
margin: 0;
380
}
381
}
382
383
+ .as3cf-active-region {
384
+ font-style: italic;
385
}
386
+
387
.as3cf-view-bucket {
388
color: #444;
389
text-decoration: none;
495
#tab-media {
496
display: block;
497
498
+ .as3cf-provider-setting td {
499
+ padding-top: 20px;
500
+ padding-bottom: 5px;
501
}
502
503
.as3cf-bucket-setting td {
504
+ padding: 5px 0;
505
}
506
}
507
530
}
531
532
.form-table {
533
+ .as3cf-provider-setting {
534
+ h4 {
535
+ font-weight: inherit;
536
+ margin: 0;
537
+ }
538
+ }
539
+ .as3cf-bucket-list {
540
+ margin: 5px 0 0 0;
541
+ }
542
td {
543
padding: 5px 0;
544
623
display: block;
624
}
625
626
#tab-support {
627
min-height: 900px;
628
.as3cf-sidebar {
780
/**
781
* Misc
782
*/
783
+ .as3cf-active-provider, .as3cf-active-bucket {
784
+ font-weight: bold;
785
+ margin-right: 10px;
786
+ }
787
+
788
.as3cf-banner {
789
margin-top: 35px;
790
width: 292px;
881
}
882
}
883
884
.as3cf-settings {
885
h3 {
886
font-size: 20px;
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -1,31 +1,33 @@
1
<?php
2
3
- use DeliciousBrains\WP_Offload_S3\Providers\AWS_Provider;
4
- use DeliciousBrains\WP_Offload_S3\Providers\Null_Provider;
5
- use DeliciousBrains\WP_Offload_S3\Providers\Provider;
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;
9
- use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Filter_Post_Excerpt;
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 Provider
17
*/
18
- private $aws;
19
20
/**
21
* @var Provider
22
*/
23
- private $s3client;
24
25
/**
26
* @var string
27
*/
28
- private $s3client_region;
29
30
/**
31
* @var array
@@ -60,7 +62,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
60
/**
61
* @var AS3CF_S3_To_Local
62
*/
63
- public $filter_s3;
64
65
/**
66
* @var AS3CF_Notices
@@ -77,6 +79,16 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
77
*/
78
protected static $buckets_check = array();
79
80
/**
81
* @var AS3CF_Plugin_Compatibility
82
*/
@@ -85,7 +97,14 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
85
const DEFAULT_EXPIRES = 900;
86
87
const SETTINGS_KEY = 'tantan_wordpress_s3';
88
- const SETTINGS_CONSTANT = 'WPOS3_SETTINGS';
89
90
const LATEST_UPGRADE_ROUTINE = 6;
91
@@ -109,12 +128,19 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
109
* Abstract class constructor
110
*
111
* @param string $plugin_file_path
112
*/
113
function init( $plugin_file_path ) {
114
- $this->plugin_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
115
- $this->plugin_menu_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
116
117
- $this->set_aws( new AWS_Provider( $this ) );
118
119
// Bundled SDK may require AWS setup before data migrations.
120
$this->handle_aws_access_key_migration();
@@ -125,6 +151,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
125
new Upgrade_Content_Replace_URLs( $this );
126
new Upgrade_EDD_Replace_URLs( $this );
127
new Upgrade_Filter_Post_Excerpt( $this );
128
129
// Plugin setup
130
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
@@ -135,12 +162,12 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
135
add_filter( 'pre_get_space_used', array( $this, 'multisite_get_space_used' ) );
136
// display a notice when either lite or pro is automatically deactivated
137
add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
138
- add_action( 'as3cf_plugin_load', array( $this, 'remove_aws_keys_if_constants_set' ) );
139
140
// Attachment screens/modals
141
add_action( 'load-upload.php', array( $this, 'load_media_assets' ), 11 );
142
add_action( 'admin_enqueue_scripts', array( $this, 'load_attachment_assets' ), 11 );
143
- add_action( 'add_meta_boxes', array( $this, 'attachment_s3_meta_box' ) );
144
145
// UI AJAX
146
add_action( 'wp_ajax_as3cf-get-buckets', array( $this, 'ajax_get_buckets' ) );
@@ -148,10 +175,8 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
148
add_action( 'wp_ajax_as3cf-create-bucket', array( $this, 'ajax_create_bucket' ) );
149
add_action( 'wp_ajax_as3cf-manual-save-bucket', array( $this, 'ajax_save_bucket' ) );
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
- add_action( 'wp_ajax_as3cf-aws-keys-set', array( $this, 'ajax_set_aws_keys' ) );
154
- add_action( 'wp_ajax_as3cf-aws-keys-remove', array( $this, 'ajax_remove_aws_keys' ) );
155
156
// Rewriting URLs, doesn't depend on plugin being setup
157
add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
@@ -163,7 +188,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
163
add_filter( 'wp_audio_shortcode', array( $this, 'wp_media_shortcode' ), 100, 5 );
164
add_filter( 'wp_video_shortcode', array( $this, 'wp_media_shortcode' ), 100, 5 );
165
166
- // Communication with S3, plugin needs to be setup
167
add_filter( 'wp_handle_upload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 1 );
168
add_filter( 'wp_handle_sideload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 1 );
169
add_filter( 'wp_update_attachment_metadata', array( $this, 'wp_update_attachment_metadata' ), 110, 2 );
@@ -171,11 +196,13 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
171
add_filter( 'update_attached_file', array( $this, 'update_attached_file' ), 100, 2 );
172
173
// Listen for settings changes
174
- add_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed_bucket', array( $this, 'bucket_changed' ) );
175
176
// Content filtering
177
- $this->filter_local = new AS3CF_Local_To_S3( $this );
178
- $this->filter_s3 = new AS3CF_S3_To_Local( $this );
179
180
// include compatibility code for other plugins
181
$this->plugin_compat = new AS3CF_Plugin_Compatibility( $this );
@@ -184,22 +211,86 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
184
185
// Register modal scripts and styles
186
$this->register_modal_assets();
187
}
188
189
/**
190
* @return Provider
191
*/
192
- public function get_aws() {
193
- return $this->aws;
194
}
195
196
/**
197
- * TODO: Remove once Provider fully set up, this is currently required for unit tests.
198
*
199
- * @param Provider $aws
200
*/
201
- public function set_aws( $aws ) {
202
- $this->aws = $aws;
203
}
204
205
/**
@@ -271,7 +362,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
271
// use settings from $_POST when generating URL preview via AJAX
272
if ( isset( $_POST['action'] ) && 'as3cf-get-url-preview' == sanitize_key( $_POST['action'] ) ) { // input var okay
273
$this->verify_ajax_request();
274
- $value = 0;
275
if ( isset( $_POST[ $key ] ) ) { // input var okay
276
$value = $_POST[ $key ]; // input var okay
277
if ( is_array( $value ) ) {
@@ -389,8 +480,35 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
389
return $force_https;
390
}
391
392
$value = parent::get_setting( $key, $default );
393
394
// Bucket
395
if ( false !== ( $bucket = $this->get_setting_bucket( $key, $value ) ) ) {
396
return $bucket;
@@ -399,6 +517,31 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
399
return apply_filters( 'as3cf_setting_' . $key, $value );
400
}
401
402
/**
403
* Get the region setting
404
*
@@ -428,7 +571,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
428
429
// Region of bucket translation
430
if ( 'region' === $key && isset( $settings['region'] ) ) {
431
- return $this->get_aws()->sanitize_region( $settings['region'] );
432
}
433
434
return false;
@@ -437,9 +580,9 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
437
/**
438
* Get the bucket and if a constant save to database and clear region
439
*
440
- * @param string $key
441
- * @param string $value
442
- * @param string $constant
443
*
444
* @return string|false
445
*/
@@ -555,30 +698,16 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
555
556
// Remove disallowed characters from custom domain
557
if ( 'cloudfront' === $key ) {
558
- $value = $this->sanitize_custom_domain( $value );
559
}
560
561
parent::set_setting( $key, $value );
562
}
563
564
- /**
565
- * Sanitize custom domain
566
- *
567
- * @param string $domain
568
- *
569
- * @return string
570
- */
571
- function sanitize_custom_domain( $domain ) {
572
- $domain = preg_replace( '@^[a-zA-Z]*:\/\/@', '', $domain );
573
- $domain = preg_replace( '@[^a-zA-Z0-9\.\-]@', '', $domain );
574
-
575
- return $domain;
576
- }
577
-
578
/**
579
* Disables the save button if all settings have been defined.
580
*
581
- * @param string $defined_settings
582
*
583
* @return string
584
*/
@@ -637,7 +766,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
637
}
638
639
/**
640
- * Allowed mime types array that can be edited for specific S3 uploading
641
*
642
* @return array
643
*/
@@ -712,7 +841,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
712
}
713
714
/**
715
- * Generate a preview of the URL of files uploaded to S3
716
*
717
* @param bool $escape
718
* @param string $suffix
@@ -720,7 +849,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
720
* @return string
721
*/
722
function get_url_preview( $escape = true, $suffix = 'photo.jpg' ) {
723
- $scheme = $this->get_s3_url_scheme();
724
$bucket = $this->get_setting( 'bucket' );
725
$path = $this->maybe_update_cloudfront_path( $this->get_file_prefix() );
726
$region = $this->get_setting( 'region' );
@@ -728,7 +857,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
728
$region = '';
729
}
730
731
- $domain = $this->get_s3_url_domain( $bucket, $region, null, array(), true );
732
733
$url = $scheme . '://' . $domain . '/' . $path . $suffix;
734
@@ -749,8 +878,9 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
749
$url = $this->get_url_preview();
750
751
$out = array(
752
- 'success' => '1',
753
- 'url' => $url,
754
);
755
756
$this->end_ajax( $out );
@@ -771,105 +901,49 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
771
}
772
773
/**
774
- * Set AWS keys via ajax.
775
*/
776
- public function ajax_set_aws_keys() {
777
- check_ajax_referer( 'as3cf-aws-keys-set' );
778
-
779
- $key_id = filter_input( INPUT_POST, 'aws-access-key-id' );
780
- $secret_key = filter_input( INPUT_POST, 'aws-secret-access-key' );
781
- $response = array(
782
- 'message' => __( 'Access keys updated successfully.', 'amazon-s3-and-cloudfront' ),
783
- );
784
-
785
if ( AWS_Provider::is_any_access_key_constant_defined() ) {
786
- wp_send_json_error( array(
787
- 'message' => __( 'All access key constants must be removed before keys can be set in the database.', 'amazon-s3-and-cloudfront' ),
788
- ) );
789
- }
790
-
791
- if ( $key_id ) {
792
- $this->set_setting( 'aws-access-key-id', $key_id );
793
- } else {
794
- wp_send_json_error( array(
795
- 'message' => __( 'The Access Key ID must be set.', 'amazon-s3-and-cloudfront' ),
796
- ) );
797
- }
798
-
799
- // Only update the secret key if entered and not set to "-- not shown --".
800
- 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' ) ) {
801
- // AWS Secret Access keys are 40 char long.
802
- if ( ! $secret_key || strlen( $secret_key ) < 40 ) {
803
- wp_send_json_error( array(
804
- 'message' => __( 'The Secret Access Key must be at least 40 characters long.', 'amazon-s3-and-cloudfront' ),
805
- ) );
806
- }
807
-
808
- $this->set_setting( 'aws-secret-access-key', $secret_key );
809
}
810
-
811
- $this->save_settings();
812
-
813
- wp_send_json_success( $response );
814
}
815
816
/**
817
- * Remove AWS access keys via ajax.
818
*/
819
- public function ajax_remove_aws_keys() {
820
- check_ajax_referer( 'as3cf-aws-keys-remove' );
821
-
822
- $this->remove_aws_keys();
823
-
824
- wp_send_json_success( array(
825
- 'message' => __( 'Access keys removed from the database successfully.', 'amazon-s3-and-cloudfront' ),
826
- ) );
827
- }
828
-
829
- /**
830
- * Remove AWS access keys from saved settings if a key constant is defined.
831
- */
832
- public function remove_aws_keys_if_constants_set() {
833
- if ( AWS_Provider::is_any_access_key_constant_defined() ) {
834
- $this->remove_aws_keys();
835
- }
836
- }
837
-
838
- /**
839
- * Remove AWS keys from settings.
840
- */
841
- protected function remove_aws_keys() {
842
- $this->remove_setting( 'aws-access-key-id' );
843
- $this->remove_setting( 'aws-secret-access-key' );
844
$this->save_settings();
845
}
846
847
/**
848
- * Delete bulk objects from an S3 bucket
849
*
850
* @param string $region
851
* @param string $bucket
852
* @param array $objects
853
* @param bool $log_error
854
* @param bool $return_on_error
855
- * @param bool $force_new_s3_client if we are deleting in bulk, force new S3 client
856
- * to cope with possible different regions
857
*
858
* @return bool
859
*/
860
- function delete_s3_objects( $region, $bucket, $objects, $log_error = false, $return_on_error = false, $force_new_s3_client = false ) {
861
$chunks = array_chunk( $objects, 1000 );
862
863
try {
864
foreach ( $chunks as $chunk ) {
865
- $this->get_s3client( $region, $force_new_s3_client )->delete_objects( array(
866
'Bucket' => $bucket,
867
'Objects' => $chunk,
868
) );
869
}
870
} catch ( Exception $e ) {
871
if ( $log_error ) {
872
- AS3CF_Error::log( 'Error removing files from S3: ' . $e->getMessage() );
873
}
874
875
return false;
@@ -879,22 +953,22 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
879
}
880
881
/**
882
- * Removes an attachment's files from S3.
883
*
884
* @param int $post_id
885
- * @param array $s3object
886
* @param bool $remove_backup_sizes remove previous edited image versions
887