Version Description
= 1.1 = This is a major change, which ensures S3 URLs are no longer saved in post content. Instead, local URLs are filtered on page generation and replaced with the S3 version. If you depend on the S3 URLs being stored in post content you will need to make modifications to support this version.
= 0.6 = This version requires PHP 5.3.3+ and the Amazon Web Services plugin
Download this release
Release Info
| Developer | deliciousbrains |
| Plugin | |
| Version | 1.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.1 to 1.3
- README.md +18 -1
- assets/css/notice.css +1 -1
- assets/css/styles.css +1 -1
- assets/img/as3cf-banner-bw.jpg +0 -0
- assets/img/as3cf-banner-bw@2x.jpg +0 -0
- assets/img/as3cf-banner.jpg +0 -0
- assets/img/as3cf-banner@2x.jpg +0 -0
- assets/img/aws-logo.svg +17 -0
- assets/img/icon-assets-pull.svg +10 -0
- assets/img/icon16.png +0 -0
- assets/img/snail-banner.jpg +0 -0
- assets/img/snail-banner@2x.jpg +0 -0
- assets/js/script.js +145 -14
- assets/js/script.min.js +1 -1
- assets/sass/notice.scss +5 -1
- assets/sass/styles.scss +205 -30
- classes/amazon-s3-and-cloudfront.php +366 -136
- classes/amazon-web-services.php +167 -0
- classes/{wp-aws-compatibility-check.php → as3cf-compatibility-check.php} +175 -19
- classes/as3cf-filter.php +14 -0
- classes/as3cf-plugin-base.php +605 -0
- classes/as3cf-plugin-compatibility.php +86 -1
- classes/as3cf-stream-wrapper.php +6 -3
- classes/as3cf-utils.php +17 -71
- classes/filters/as3cf-local-to-s3.php +51 -14
- classes/upgrades/upgrade.php +1 -1
- composer.json +2 -2
- languages/amazon-s3-and-cloudfront-en.pot +375 -150
- readme.txt +18 -1
- vendor/Aws2/aws/aws-sdk-php/LICENSE.md +141 -0
- vendor/Aws2/aws/aws-sdk-php/NOTICE.md +112 -0
- vendor/Aws2/aws/aws-sdk-php/composer.json +51 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Aws.php +97 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php +215 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AwsClientInterface.php +107 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ClientBuilder.php +429 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/DefaultClient.php +63 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ExpiredCredentialsChecker.php +68 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ThrottlingErrorChecker.php +60 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UploadBodyListener.php +87 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UserAgentListener.php +58 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/AwsQueryVisitor.php +108 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/JsonCommand.php +43 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/QueryCommand.php +49 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/XmlResponseLocationVisitor.php +63 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractCredentialsDecorator.php +120 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractRefreshableCredentials.php +80 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CacheableCredentials.php +69 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/Credentials.php +270 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CredentialsInterface.php +88 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/NullCredentials.php +59 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/RefreshableInstanceProfileCredentials.php +75 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum.php +51 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/ClientOptions.php +142 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/DateFormat.php +30 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Region.php +52 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Size.php +46 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Time.php +39 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/UaString.php +49 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/AwsExceptionInterface.php +30 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/BadMethodCallException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/DomainException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionFactoryInterface.php +35 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionListener.php +55 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InstanceProfileCredentialsException.php +47 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InvalidArgumentException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/LogicException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/MultipartUploadException.php +47 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php +89 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/OutOfBoundsException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/OverflowException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/AbstractJsonExceptionParser.php +54 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/DefaultXmlExceptionParser.php +93 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/ExceptionParserInterface.php +41 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/JsonQueryExceptionParser.php +39 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/JsonRestExceptionParser.php +44 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/RequiredExtensionNotLoadedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/RuntimeException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ServiceResponseException.php +194 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/TransferException.php +25 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/UnexpectedValueException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/Facade.php +65 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/FacadeInterface.php +34 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/facade-classes.php +249 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/ChunkHash.php +77 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/ChunkHashInterface.php +49 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/HashUtils.php +70 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/TreeHash.php +169 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/HostNameUtils.php +75 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/InstanceMetadataClient.php +81 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/Waiter/ServiceAvailable.php +46 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Iterator/AwsResourceIterator.php +152 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Iterator/AwsResourceIteratorFactory.php +84 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractTransfer.php +219 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractTransferState.php +145 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadBuilder.php +131 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadId.php +81 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadPart.php +91 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/TransferInterface.php +61 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/TransferStateInterface.php +84 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/UploadIdInterface.php +38 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/UploadPartInterface.php +44 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/aws-config.php +17 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/public-endpoints.php +3 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/sdk1-config.php +17 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/RulesEndpointProvider.php +55 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/AbstractSignature.php +39 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/EndpointSignatureInterface.php +41 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureInterface.php +46 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureListener.php +76 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV2.php +86 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV3Https.php +47 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV4.php +360 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/AbstractResourceWaiter.php +48 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/AbstractWaiter.php +120 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/CallableWaiter.php +73 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/CompositeWaiterFactory.php +81 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/ConfigResourceWaiter.php +185 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/ResourceWaiterInterface.php +33 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterClassFactory.php +95 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterConfig.php +64 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterConfigFactory.php +86 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterFactoryInterface.php +40 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterInterface.php +56 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/AcpListener.php +68 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/BucketStyleListener.php +73 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Command/S3Command.php +57 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/CannedAcl.php +31 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/EncodingType.php +26 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Event.php +26 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/GranteeType.php +28 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Group.php +28 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/MFADelete.php +27 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/MetadataDirective.php +27 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Payer.php +27 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Permission.php +30 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Protocol.php +27 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/ServerSideEncryption.php +26 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Status.php +27 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Storage.php +28 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/StorageClass.php +27 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AccessDeniedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AccountProblemException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AmbiguousGrantByEmailAddressException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BadDigestException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketAlreadyExistsException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketAlreadyOwnedByYouException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketNotEmptyException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/CredentialsNotSupportedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/CrossLocationLoggingProhibitedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/DeleteMultipleObjectsException.php +46 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/EntityTooLargeException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/EntityTooSmallException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ExpiredTokenException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IllegalVersioningConfigurationException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IncompleteBodyException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IncorrectNumberOfFilesInPostRequestException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InlineDataTooLargeException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InternalErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidAccessKeyIdException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidAddressingHeaderException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidArgumentException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidBucketNameException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidBucketStateException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidDigestException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidLocationConstraintException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPartException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPartOrderException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPayerException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPolicyDocumentException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidRangeException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidRequestException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidSOAPRequestException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidSecurityException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidStorageClassException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTagErrorException.php +25 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTargetBucketForLoggingException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTokenException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidURIException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/KeyTooLongException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedACLErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedPOSTRequestException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedXMLException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MaxMessageLengthExceededException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MaxPostPreDataLengthExceededErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MetadataTooLargeException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MethodNotAllowedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingAttachmentException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingContentLengthException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingRequestBodyErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingSecurityElementException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingSecurityHeaderException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoLoggingStatusForKeyException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchBucketException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchBucketPolicyException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchCORSConfigurationException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchKeyException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchLifecycleConfigurationException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchTagSetException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchUploadException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchVersionException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchWebsiteConfigurationException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotImplementedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotSignedUpException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotSuchBucketPolicyException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ObjectAlreadyInActiveTierErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ObjectNotInActiveTierErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/OperationAbortedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/Parser/S3ExceptionParser.php +65 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/PermanentRedirectException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/PreconditionFailedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RedirectException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestIsNotMultiPartContentException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTimeTooSkewedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTimeoutException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTorrentOfBucketErrorException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/S3Exception.php +25 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ServiceUnavailableException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/SignatureDoesNotMatchException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/SlowDownException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TemporaryRedirectException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TokenRefreshRequiredException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TooManyBucketsException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UnexpectedContentException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UnresolvableGrantByEmailAddressException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UserKeyMustBeSpecifiedException.php +24 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/IncompleteMultipartUploadChecker.php +44 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListBucketsIterator.php +45 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListMultipartUploadsIterator.php +43 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListObjectVersionsIterator.php +45 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListObjectsIterator.php +62 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/OpendirIterator.php +75 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Acp.php +208 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/AcpBuilder.php +120 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/ClearBucket.php +161 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/DeleteObjectsBatch.php +72 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/DeleteObjectsTransfer.php +112 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Grant.php +114 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Grantee.php +211 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/AbstractTransfer.php +83 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php +100 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php +65 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/TransferState.php +38 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadBuilder.php +243 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadId.php +30 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadPart.php +62 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/PostObject.php +229 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Resources/s3-2006-03-01.php +17 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/ResumableDownload.php +150 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Client.php +524 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Md5Listener.php +65 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Signature.php +191 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3SignatureInterface.php +25 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3SignatureV4.php +53 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/SocketTimeoutChecker.php +60 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/SseCpkListener.php +54 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/StreamWrapper.php +757 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/AbstractSync.php +114 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/AbstractSyncBuilder.php +359 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/ChangedFilesIterator.php +105 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/DownloadSync.php +83 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/DownloadSyncBuilder.php +97 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/FilenameConverterInterface.php +32 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/KeyConverter.php +55 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSync.php +61 -0
- vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSyncBuilder.php +147 -0
- vendor/Aws2/guzzle/guzzle/CHANGELOG.md +729 -0
README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
**Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
|
| 4 |
**Requires at least:** 4.6
|
| 5 |
**Tested up to:** 4.9
|
| 6 |
-
**Stable tag:** 1.
|
| 7 |
**License:** GPLv3
|
| 8 |
|
| 9 |
Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
|
|
@@ -69,6 +69,23 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
|
|
| 69 |
|
| 70 |
## Changelog ##
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
### WP Offload S3 Lite 1.2.1 - 2017-11-20 ###
|
| 73 |
* New: Compatibility with HTML Widget
|
| 74 |
* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
|
| 3 |
**Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
|
| 4 |
**Requires at least:** 4.6
|
| 5 |
**Tested up to:** 4.9
|
| 6 |
+
**Stable tag:** 1.3
|
| 7 |
**License:** GPLv3
|
| 8 |
|
| 9 |
Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
|
| 69 |
|
| 70 |
## Changelog ##
|
| 71 |
|
| 72 |
+
### WP Offload S3 Lite 1.3 - 2018-02-20 ###
|
| 73 |
+
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
|
| 74 |
+
* New: [Amazon Web Services plugin](https://wordpress.org/plugins/amazon-web-services/) is no longer required to run WP Offload S3 Lite
|
| 75 |
+
* New: Added [`as3cf_local_domains`](https://deliciousbrains.com/wp-offload-s3/doc/filtering-urls-for-multiple-domains/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) filter for when site content is updated through multiple domains
|
| 76 |
+
* Improvement: AWS keys can be set in new "Settings" tab if not defined in wp-config.php
|
| 77 |
+
* Improvement: Minor tweaks to settings page UI including right aligning tabs and consistent title across Lite and Pro plugins
|
| 78 |
+
* Improvement: cURL version, theme version and parent theme information added to diagnostics
|
| 79 |
+
* Bug fix: Incompatible with plugins that include AWS PHP SDK v3
|
| 80 |
+
* Bug fix: Regenerate Thumbnails v3.0+ does not work with Remove Files From Server option
|
| 81 |
+
* Bug fix: "Warning: count(): Parameter must be an array or an object that implements Countable" error with PHP 7.2
|
| 82 |
+
* Bug fix: Force HTTPS not being applied to non-srcset S3 URLs in pages served over HTTP
|
| 83 |
+
* Bug fix: Content URLs not filtered to S3 URLs if AWS keys not set
|
| 84 |
+
* Bug fix: URL preview can be coerced to display invalid URL
|
| 85 |
+
* Bug fix: Changes to upload made via `as3cf_object_meta` filter are not reflected in amazonS3_info records
|
| 86 |
+
* Bug fix: Settings link not showing in network admin plugins page
|
| 87 |
+
* Bug fix: License in composer.json fails Packagist validation
|
| 88 |
+
|
| 89 |
### WP Offload S3 Lite 1.2.1 - 2017-11-20 ###
|
| 90 |
* New: Compatibility with HTML Widget
|
| 91 |
* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
|
assets/css/notice.css
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
.as3cf-notice p,.
|
| 1 |
+
.as3cf-notice p,.as3cf-compatibility-notice p{max-width:800px}.as3cf-license-notice p:not(.as3cf-before):before{display:none}.as3cf-notice-warning{border-left-color:#ffba00}
|
assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
.aws-main.wrap{position:relative}.aws-main.wrap>h1{float:left}.aws-main.wrap .as3cf-notice,.aws-main.wrap .as3cf-updated,.aws-main.wrap .as3cf-error{-webkit-box-sizing:border-box;box-sizing:border-box}.aws-main.wrap .as3cf-error.fatal{clear:both}.aws-main.wrap h2.nav-tab-wrapper{float:none;margin-bottom:15px;width:650px;margin-top:10px;padding:9px 0 0 5px}.aws-main.wrap h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.aws-main.wrap h2.nav-tab-wrapper a:focus{-webkit-box-shadow:none;box-shadow:none}.aws-main.wrap .more-info{white-space:nowrap}.aws-main.wrap .error pre{background:#eaeaea;background:rgba(0,0,0,0.07);display:block;padding:10px 15px}.aws-main.wrap .error pre code{padding:0;background:none}.aws-main.wrap[data-tab="support"] .as3cf-notice,.aws-main.wrap[data-tab="support"] .error,.aws-main.wrap[data-tab="support"] .updated,.aws-main.wrap[data-tab="support"] .updated.show{display:none}.aws-main.wrap[data-tab="support"] .fatal .error,.aws-main.wrap[data-tab="support"] .as3cf-notice.important,.aws-main.wrap[data-tab="support"] .dbrains-api-down{display:block}.aws-main.wrap .as3cf-notice,.aws-main.wrap .error,.aws-main.wrap .updated{max-width:650px;margin-top:15px;-webkit-box-sizing:border-box;box-sizing:border-box}.aws-main.wrap .as3cf-updated{display:none}.aws-main.wrap .as3cf-updated.as3cf-notice,.aws-main.wrap .as3cf-updated.show{display:block}.as3cf-tab .as3cf-main-settings{display:none}.as3cf-tab .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-main-settings{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-tab{display:none;position:relative;width:650px}.as3cf-tab .as3cf-main-settings p{font-size:13px}.as3cf-tab .as3cf-main-settings p a{color:#444}.as3cf-tab .object-prefix-desc em{white-space:nowrap}.as3cf-tab .as3cf-url-preview-wrap{background:#fff;text-align:center;padding:20px 0 0;max-width:650px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-tab .as3cf-url-preview-wrap .as3cf-url-preview{margin-top:10px;padding:0 20px 10px;overflow-x:scroll}.as3cf-tab .as3cf-url-preview-wrap span{color:#aaa;text-transform:uppercase;font-weight:bold}.as3cf-tab .as3cf-radio-group label{display:block;margin-bottom:10px}.as3cf-tab .as3cf-radio-group label.disabled,.as3cf-tab .as3cf-radio-group label.disabled p{color:#bbb;cursor:default}.as3cf-tab .as3cf-radio-group p{padding-left:25px;color:#6b6b6b;margin:0;font-size:12px}.as3cf-tab .as3cf-radio-group p.as3cf-setting{margin-top:5px}.as3cf-tab .as3cf-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;-webkit-border-radius:2px;background-color:#d4d3d3;cursor:pointer}.as3cf-tab .as3cf-switch.on{background-color:#ade7b5}.as3cf-tab .as3cf-switch span{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;-webkit-border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.as3cf-tab .as3cf-switch span.on{color:#82d78b}.as3cf-tab .as3cf-switch span.checked{visibility:visible}.as3cf-tab .as3cf-switch.disabled{cursor:default;background:#e6e6e6}.as3cf-tab .as3cf-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.as3cf-tab .as3cf-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.as3cf-tab .as3cf-setting.hide{display:none}.as3cf-tab div.as3cf-setting{margin-top:4px}.as3cf-tab h3{font-weight:normal;text-transform:uppercase;margin:15px 0}.as3cf-tab .form-table{margin:0}.as3cf-tab .form-table tr.as3cf-border-bottom td{border-bottom:1px solid #ddd;padding:20px 0px}.as3cf-tab .form-table tr.as3cf-setting-title td{padding-bottom:0}.as3cf-tab .form-table tr.as3cf-setting-title:first-child td{padding-top:20px}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px}.as3cf-tab .form-table tr td .as3cf-notice:last-child{margin-bottom:0}.as3cf-tab .form-table tr td>p:first-child{margin-top:0}.as3cf-tab .form-table tr:first-of-type td{padding-top:5px}.as3cf-tab .form-table tr.as3cf-bucket-setting .as3cf-defined-in-config{float:none}.as3cf-tab .form-table h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-bucket{font-weight:bold;margin-right:10px}.as3cf-tab .as3cf-view-bucket{color:#444;text-decoration:none;margin-right:10px}.as3cf-tab .as3cf-view-bucket:hover,.as3cf-tab .as3cf-view-bucket:active{color:#00a0d2}.as3cf-tab .as3cf-view-bucket:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-tab .as3cf-view-bucket .dashicons-external{margin-top:-2px}.as3cf-tab .tooltip{position:relative;z-index:2;cursor:pointer}.as3cf-tab .tooltip:before,.as3cf-tab .tooltip:after{visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;pointer-events:none}.as3cf-tab .tooltip:before{position:absolute;bottom:150%;left:50%;margin-bottom:5px;margin-left:-250px;padding:10px;width:500px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,0.9);color:#fff;content:attr(data-tooltip);text-align:center;font-size:14px;line-height:1.3}.as3cf-tab .tooltip:after{position:absolute;bottom:150%;left:50%;margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,0.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.as3cf-tab .tooltip:hover:before,.as3cf-tab .tooltip:hover:after{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.as3cf-tab .as3cf-defined-in-config{background:#ccc;color:#fff;padding:2px 5px;margin:0 0 5px 5px;float:right}.as3cf-tab .as3cf-defined-setting{color:#bbb}.as3cf-tab .as3cf-defined-setting label{cursor:default}.as3cf-tab .as3cf-defined-setting p .more-info a{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-radio-group p{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-notice{display:none !important}#tab-media{display:block}#tab-media .as3cf-main-settings{display:none}#tab-media .as3cf-bucket-container{display:block}#tab-media.as3cf-has-bucket .as3cf-main-settings{display:block}#tab-media.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-bucket-container h3{line-height:1.3;text-transform:none}.as3cf-bucket-container a:focus{-webkit-box-shadow:none;box-shadow:none;outline:none}.as3cf-bucket-container input[type=text]{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%}.as3cf-bucket-container select{-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.as3cf-bucket-container .form-table td{padding:5px 0}.as3cf-bucket-container .form-table td:first-child{width:100px;line-height:30px;vertical-align:top}.as3cf-bucket-container .bucket-actions{margin:15px 0;border-top:1px solid #ccc;padding-top:15px;overflow:hidden}.as3cf-bucket-container .bucket-actions button,.as3cf-bucket-container .bucket-actions .right{float:right;margin-right:0}.as3cf-bucket-container .bucket-actions span{display:inline-block;margin-right:20px;line-height:28px}.as3cf-bucket-container .bucket-actions .bucket-action-cancel{color:#a00;text-decoration:none}.as3cf-bucket-container .bucket-actions .bucket-action-cancel:hover{color:red}.as3cf-bucket-container .as3cf-bucket-list{padding:15px;max-height:200px;overflow-x:hidden;overflow-y:auto;background-color:#fff;font-size:14px}.as3cf-bucket-container .as3cf-bucket-list li:last-of-type{margin-bottom:0}.as3cf-bucket-container .as3cf-bucket-list a{color:#444;text-decoration:none}.as3cf-bucket-container .as3cf-bucket-list a:hover{color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a.selected{font-weight:bold;color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a .dashicons{margin-right:5px}.as3cf-bucket-container .as3cf-bucket-select,.as3cf-bucket-container .as3cf-bucket-create{display:none}.as3cf-bucket-container .bucket-actions.select{display:none}.as3cf-tab{display:none}#tab-media{display:block}#tab-support{min-height:900px}#tab-support .as3cf-sidebar{top:11px}#tab-support .support-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}#tab-support .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.as3cf-sidebar{position:absolute;top:9px;left:670px;width:292px}.as3cf-sidebar .block{padding:20px;border:1px solid #ccc}.as3cf-sidebar .subscribe{border-top:none}.as3cf-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}.as3cf-sidebar .subscribe h3{font-size:16px;margin:0}.as3cf-sidebar .subscribe p{margin:0}.as3cf-sidebar .subscribe .intro{margin-bottom:1em;line-height:1.4}.as3cf-sidebar .subscribe li{line-height:1.4}.as3cf-sidebar .subscribe .links{margin-bottom:2em}.as3cf-sidebar .subscribe .links a{text-decoration:none}.as3cf-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}.as3cf-sidebar .subscribe .field{margin-bottom:0.5em}.as3cf-sidebar .subscribe .field p{margin-bottom:0.3em}.as3cf-sidebar .subscribe .field input[type=text],.as3cf-sidebar .subscribe .field input[type=email]{width:100%}.as3cf-sidebar .subscribe .field.submit-button{margin-bottom:1em}.as3cf-sidebar .credits{border-top:0}.as3cf-sidebar .credits h4{font-size:16px;margin-top:0;margin-bottom:10px}.as3cf-sidebar .credits ul{margin:0}.as3cf-sidebar .credits li{overflow:hidden}.as3cf-sidebar .credits li:last-child{margin-bottom:0}.as3cf-sidebar .credits img{float:left;margin-right:10px}.as3cf-sidebar .credits span{float:left;display:block;line-height:32px}.as3cf-sidebar .credits a{display:block;text-decoration:none;color:#444;font-size:16px;text-align:center}.as3cf-sidebar .credits a:hover{color:#888}@media screen and (max-width: 1052px){.as3cf-sidebar{position:relative;top:auto;right:auto}}.as3cf-banner{margin-top:35px;width:292px;height:200px;display:block;background:#f8cfae url(../img/os3-banner.svg) left bottom/220px 220px no-repeat}.as3cf-banner:focus{-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details{background-color:#4e0d33;padding:10px 20px 20px 20px;color:#eee;font-size:13px;margin:0;display:block;text-decoration:none}.wrap .as3cf-upgrade-details h1{font-size:28px;color:#eee;margin:0 0 15px 0;padding:0;text-decoration:none;font-weight:200;line-height:1}.wrap .as3cf-upgrade-details p{margin:0}.wrap .as3cf-upgrade-details a{color:#eee;font-weight:bold;text-decoration:none;font-size:16px;-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details a:hover{color:#fff}.wrap .as3cf-upgrade-details ul{margin-top:0;margin-left:16px;list-style-type:disc}.aws-compatibility-notice.error{clear:both;margin:5px 20px 5px 0}.as3cf-bucket-error span.title{font-weight:bold}.as3cf-invalid-bucket-name,.as3cf-validation-error{display:block;margin-top:2px;font-size:12px;color:#a00}.as3cf-notice-toggle-content{max-height:100px;overflow-y:scroll}.as3cf-notice-toggle-content .as3cf-notice-toggle-list{margin-top:0;margin-left:0;padding-left:40px;color:#dc3232}
|
| 1 |
+
.as3cf-content,.as3cf-updated,.as3cf-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.settings_page_amazon-s3-and-cloudfront .error,.settings_page_amazon-s3-and-cloudfront .notice,.settings_page_amazon-s3-and-cloudfront .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.as3cf-main.wrap{position:relative}.as3cf-main.wrap>h1{float:left}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .as3cf-updated,.as3cf-main.wrap .as3cf-error{-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-error.fatal{clear:both}.as3cf-main.wrap h2.nav-tab-wrapper{float:none;margin-bottom:15px;width:650px;margin-top:10px;padding:9px 0 0 5px}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container{float:right}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container :last-child{margin-right:5px}.as3cf-main.wrap h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.as3cf-main.wrap h2.nav-tab-wrapper a:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-main.wrap .more-info{white-space:nowrap}.as3cf-main.wrap .error pre{background:#eaeaea;background:rgba(0,0,0,0.07);display:block;padding:10px 15px}.as3cf-main.wrap .error pre code{padding:0;background:none}.as3cf-main.wrap[data-tab="support"] .as3cf-notice,.as3cf-main.wrap[data-tab="support"] .error,.as3cf-main.wrap[data-tab="support"] .updated,.as3cf-main.wrap[data-tab="support"] .updated.show{display:none}.as3cf-main.wrap[data-tab="support"] .fatal .error,.as3cf-main.wrap[data-tab="support"] .as3cf-notice.important,.as3cf-main.wrap[data-tab="support"] .dbrains-api-down{display:block}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .error,.as3cf-main.wrap .updated{max-width:650px;margin-top:15px;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-updated{display:none}.as3cf-main.wrap .as3cf-updated.as3cf-notice,.as3cf-main.wrap .as3cf-updated.show{display:block}.as3cf-main.wrap .alignleft{margin-right:20px;margin-bottom:20px}.as3cf-main.wrap .spinner{min-width:20px}.as3cf-tab .as3cf-main-settings{display:none}.as3cf-tab .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-main-settings{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-content>section{margin-bottom:20px}.as3cf-content>section+section.as3cf-access-keys{padding-top:20px;border-top:1px solid #d3d3d3}.as3cf-content>section+section.as3cf-access-keys .as3cf-section-heading{margin-top:0}.as3cf-tab{display:none;position:relative;width:650px}.as3cf-tab .as3cf-main-settings p{font-size:13px}.as3cf-tab .as3cf-main-settings p a{color:#444}.as3cf-tab .object-prefix-desc em{white-space:nowrap}.as3cf-tab .as3cf-url-preview-wrap{background:#fff;text-align:center;padding:20px 0 0;max-width:650px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-tab .as3cf-url-preview-wrap .as3cf-url-preview{margin-top:10px;padding:0 20px 10px;overflow-x:scroll}.as3cf-tab .as3cf-url-preview-wrap span{color:#aaa;text-transform:uppercase;font-weight:bold}.as3cf-tab .as3cf-radio-group label{display:block;margin-bottom:10px}.as3cf-tab .as3cf-radio-group label.disabled,.as3cf-tab .as3cf-radio-group label.disabled p{color:#bbb;cursor:default}.as3cf-tab .as3cf-radio-group p{padding-left:25px;color:#6b6b6b;margin:0;font-size:12px}.as3cf-tab .as3cf-radio-group p.as3cf-setting{margin-top:5px}.as3cf-tab .as3cf-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;background-color:#d4d3d3;cursor:pointer}.as3cf-tab .as3cf-switch.on{background-color:#ade7b5}.as3cf-tab .as3cf-switch span{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.as3cf-tab .as3cf-switch span.on{color:#82d78b}.as3cf-tab .as3cf-switch span.checked{visibility:visible}.as3cf-tab .as3cf-switch.disabled{cursor:default;background:#e6e6e6}.as3cf-tab .as3cf-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.as3cf-tab .as3cf-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.as3cf-tab .as3cf-setting.hide{display:none}.as3cf-tab div.as3cf-setting{margin-top:4px}.as3cf-tab h3{font-weight:normal;text-transform:uppercase}.as3cf-tab .form-table{margin:0}.as3cf-tab .form-table tr.as3cf-border-bottom td{border-bottom:1px solid #ddd;padding:20px 0px}.as3cf-tab .form-table tr.as3cf-setting-title td{padding-bottom:0}.as3cf-tab .form-table tr.as3cf-setting-title:first-child td{padding-top:20px}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px}.as3cf-tab .form-table tr td .as3cf-notice:last-child{margin-bottom:0}.as3cf-tab .form-table tr td>p:first-child{margin-top:0}.as3cf-tab .form-table tr.as3cf-bucket-setting .as3cf-defined-in-config{float:none}.as3cf-tab .form-table h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-bucket{font-weight:bold;margin-right:10px}.as3cf-tab .as3cf-view-bucket{color:#444;text-decoration:none;margin-right:10px}.as3cf-tab .as3cf-view-bucket:hover,.as3cf-tab .as3cf-view-bucket:active{color:#00a0d2}.as3cf-tab .as3cf-view-bucket:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-tab .as3cf-view-bucket .dashicons-external{margin-top:-2px}.as3cf-tab .tooltip{position:relative;z-index:2;cursor:pointer}.as3cf-tab .tooltip:before,.as3cf-tab .tooltip:after{visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;pointer-events:none}.as3cf-tab .tooltip:before{position:absolute;bottom:150%;left:50%;margin-bottom:5px;margin-left:-250px;padding:10px;width:500px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,0.9);color:#fff;content:attr(data-tooltip);text-align:center;font-size:14px;line-height:1.3}.as3cf-tab .tooltip:after{position:absolute;bottom:150%;left:50%;margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,0.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.as3cf-tab .tooltip:hover:before,.as3cf-tab .tooltip:hover:after{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.as3cf-tab .as3cf-defined-in-config{background:#ccc;color:#fff;padding:2px 5px;margin:0 0 5px 5px;float:right;white-space:nowrap}.as3cf-tab .as3cf-defined-setting{color:#bbb}.as3cf-tab .as3cf-defined-setting label{cursor:default}.as3cf-tab .as3cf-defined-setting p .more-info a{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-radio-group p{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-notice{display:none !important}#tab-media{display:block}#tab-media .as3cf-main-settings{display:none}#tab-media .as3cf-bucket-setting td{padding-top:5px}#tab-media .as3cf-bucket-container{display:block}#tab-media.as3cf-has-bucket .as3cf-main-settings{display:block}#tab-media.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-bucket-container h3{line-height:1.3;text-transform:none}.as3cf-bucket-container a:focus{-webkit-box-shadow:none;box-shadow:none;outline:none}.as3cf-bucket-container input[type=text]{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%}.as3cf-bucket-container select{-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.as3cf-bucket-container .form-table td{padding:5px 0}.as3cf-bucket-container .form-table td:first-child{width:100px;line-height:30px;vertical-align:top}.as3cf-bucket-container .bucket-actions{margin:15px 0;border-top:1px solid #ccc;padding-top:15px;overflow:hidden}.as3cf-bucket-container .bucket-actions button,.as3cf-bucket-container .bucket-actions .right{float:right;margin-right:0}.as3cf-bucket-container .bucket-actions span{display:inline-block;margin-right:20px;line-height:28px}.as3cf-bucket-container .bucket-actions .bucket-action-cancel{color:#a00;text-decoration:none}.as3cf-bucket-container .bucket-actions .bucket-action-cancel:hover{color:red}.as3cf-bucket-container .as3cf-bucket-list{padding:15px;max-height:200px;overflow-x:hidden;overflow-y:auto;background-color:#fff;font-size:14px}.as3cf-bucket-container .as3cf-bucket-list li:last-of-type{margin-bottom:0}.as3cf-bucket-container .as3cf-bucket-list a{color:#444;text-decoration:none}.as3cf-bucket-container .as3cf-bucket-list a:hover{color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a.selected{font-weight:bold;color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a .dashicons{margin-right:5px}.as3cf-bucket-container .as3cf-bucket-select,.as3cf-bucket-container .as3cf-bucket-create{display:none}.as3cf-bucket-container .bucket-actions.select{display:none}#tab-media{display:block}#tab-settings .as3cf-field-wrap{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}#tab-settings .as3cf-field-wrap input{width:100%}#tab-settings .as3cf-field-wrap button,#tab-settings .as3cf-field-wrap .as3cf-defined-in-config{margin-left:20px}#tab-settings .as3cf-field-wrap .as3cf-defined-in-config{display:none;margin-bottom:0}#tab-settings .as3cf-field-wrap.as3cf-defined button{display:none}#tab-settings .as3cf-field-wrap.as3cf-defined .as3cf-defined-in-config{display:inline-block}#tab-settings .as3cf-field-wrap.as3cf-saved-field .as3cf-activate-licence{display:none}#tab-settings .as3cf-field-wrap.as3cf-licence-not-entered .as3cf-remove-licence{display:none}#tab-support{min-height:900px}#tab-support .as3cf-sidebar{top:11px}#tab-support .support-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}#tab-support .support-section h3{font-size:20px}#tab-support .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.as3cf-sidebar{position:absolute;top:9px;left:670px;width:292px}.as3cf-sidebar .block{padding:20px;border:1px solid #ccc}.as3cf-sidebar .subscribe{border-top:none}.as3cf-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}.as3cf-sidebar .subscribe h3{font-size:16px;margin:0}.as3cf-sidebar .subscribe p{margin:0}.as3cf-sidebar .subscribe .intro{margin-bottom:1em;line-height:1.4}.as3cf-sidebar .subscribe li{line-height:1.4}.as3cf-sidebar .subscribe .links{margin-bottom:2em}.as3cf-sidebar .subscribe .links a{text-decoration:none}.as3cf-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}.as3cf-sidebar .subscribe .field{margin-bottom:0.5em}.as3cf-sidebar .subscribe .field p{margin-bottom:0.3em}.as3cf-sidebar .subscribe .field input[type=text],.as3cf-sidebar .subscribe .field input[type=email]{width:100%}.as3cf-sidebar .subscribe .field.submit-button{margin-bottom:1em}.as3cf-sidebar .credits{border-top:0}.as3cf-sidebar .credits h4{font-size:16px;margin-top:0;margin-bottom:10px}.as3cf-sidebar .credits ul{margin:0}.as3cf-sidebar .credits li{overflow:hidden}.as3cf-sidebar .credits li:last-child{margin-bottom:0}.as3cf-sidebar .credits img{float:left;margin-right:10px}.as3cf-sidebar .credits span{float:left;display:block;line-height:32px}.as3cf-sidebar .credits a{display:block;text-decoration:none;color:#444;font-size:16px;text-align:center}.as3cf-sidebar .credits a:hover{color:#888}@media screen and (max-width: 1052px){.as3cf-sidebar{position:relative;top:auto;right:auto}}.as3cf-banner{margin-top:35px;width:292px;height:200px;display:block;background:#f8cfae url(../img/os3-banner.svg) left bottom/220px 220px no-repeat}.as3cf-banner:focus{-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details{background-color:#4e0d33;padding:10px 20px 20px 20px;color:#eee;font-size:13px;margin:0;display:block;text-decoration:none}.wrap .as3cf-upgrade-details h1{font-size:28px;color:#eee;margin:0 0 15px 0;padding:0;text-decoration:none;font-weight:200;line-height:1}.wrap .as3cf-upgrade-details p{margin:0}.wrap .as3cf-upgrade-details a{color:#eee;font-weight:bold;text-decoration:none;font-size:16px;-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details a:hover{color:#fff}.wrap .as3cf-upgrade-details ul{margin-top:0;margin-left:16px;list-style-type:disc}.as3cf-compatibility-notice.error{clear:both;margin:5px 20px 5px 0}.as3cf-bucket-error span.title{font-weight:bold}.as3cf-invalid-bucket-name,.as3cf-validation-error{display:block;margin-top:2px;font-size:12px;color:#a00}.as3cf-notice-toggle-content{max-height:100px;overflow-y:scroll}.as3cf-notice-toggle-content .as3cf-notice-toggle-list{margin-top:0;margin-left:0;padding-left:40px;color:#dc3232}.as3cf-need-help{background-color:white;font-size:16px;font-weight:bold;padding:1em}.as3cf-need-help a{text-decoration:none}.as3cf-aws-logo{color:white;background-color:#f7a80d;padding:1em}.as3cf-settings h3{font-size:20px}.as3cf-settings p{font-size:14px}.as3cf-addons,.as3cf-tab .as3cf-compatibility-notice{max-width:cover}textarea.as3cf-access-key-constants-snippet.code{width:100%;white-space:pre;overflow:hidden;font-size:12px;padding:10px;height:53px}.as3cf-addons .as3cf-addons-list{margin:20px 0 200px;padding-top:5px}.as3cf-addons .as3cf-addon{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:20px;font-size:14px}.as3cf-addons .as3cf-addon-info{min-height:100px}.as3cf-addons .as3cf-addon-links{float:right}.as3cf-addons .as3cf-addon-links span{padding:4px 6px}.as3cf-addons .as3cf-addon-icon{float:left;margin-right:20px}.as3cf-addons .as3cf-addon-details{white-space:nowrap}.as3cf-addons .as3cf-addon-title,.as3cf-addons .as3cf-addon-description{font-weight:100}.as3cf-addons .as3cf-addon+.as3cf-addon{margin-top:20px}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull{background-color:#0769ad;color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-title,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-description,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull a{color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra{background:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra a{color:#0769ad;text-decoration:none}
|
assets/img/as3cf-banner-bw.jpg
ADDED
|
Binary file
|
assets/img/as3cf-banner-bw@2x.jpg
ADDED
|
Binary file
|
assets/img/as3cf-banner.jpg
ADDED
|
Binary file
|
assets/img/as3cf-banner@2x.jpg
ADDED
|
Binary file
|
assets/img/aws-logo.svg
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
| 2 |
+
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
| 3 |
+
<svg version="1.1"
|
| 4 |
+
id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#"
|
| 5 |
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
| 6 |
+
viewBox="-243.4 335.3 101.3 79.8" enable-background="new -243.4 335.3 101.3 79.8" xml:space="preserve">
|
| 7 |
+
<path id="polygon287" fill="#FFFFFF" d="M-213.9,386.2l-9.3,4l8.6,3.7l10-3.7L-213.9,386.2z M-227.8,391.1l-0.3,17.9l13.6,6v-18.6
|
| 8 |
+
L-227.8,391.1z M-199.9,391.1l-12.3,4.7v17.6l12.3-5V391.1z"/>
|
| 9 |
+
<path id="polygon311" fill="#FFFFFF" d="M-185.3,335.3l-9.3,4l8.7,3.7l10-3.7L-185.3,335.3z M-198.2,340.6v17.9l11.6,3.4l0.4-16.3
|
| 10 |
+
L-198.2,340.6z M-172.3,341.6l-11,4.7v17.6l11-5V341.6z"/>
|
| 11 |
+
<path id="use3387" fill="#FFFFFF" d="M-229.2,360.6l-9.3,4l8.6,3.7l10-3.7L-229.2,360.6z M-243.1,365.6l-0.3,17.9l13.6,6v-18.6
|
| 12 |
+
L-243.1,365.6z M-215.2,365.6l-12.3,4.7v17.6l12.3-5V365.6z"/>
|
| 13 |
+
<path id="use3389" fill="#FFFFFF" d="M-199.2,359.9l-9.3,4l8.6,3.7l10-3.7L-199.2,359.9z M-213.2,364.9l-0.3,17.9l13.6,6v-18.6
|
| 14 |
+
L-213.2,364.9z M-185.3,364.9l-12.3,4.7v17.6l12.3-5V364.9z"/>
|
| 15 |
+
<path id="use3391" fill="#FFFFFF" d="M-156,335.3l-9.3,4l8.6,3.7l10-3.7L-156,335.3z M-170,340.3l-0.3,17.9l13.6,6v-18.6L-170,340.3
|
| 16 |
+
z M-142.1,340.3l-12.3,4.7v17.6l12.3-5V340.3z"/>
|
| 17 |
+
</svg>
|
assets/img/icon-assets-pull.svg
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
| 2 |
+
<svg width="354px" height="318px" viewBox="0 0 354 318" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
| 3 |
+
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
| 4 |
+
<title>Untitled</title>
|
| 5 |
+
<desc>Created with Sketch.</desc>
|
| 6 |
+
<defs></defs>
|
| 7 |
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
| 8 |
+
<path d="M51.269,159 C68.955,166.75 81.519,183.5 81.519,213 L81.519,247.457 C81.519,272.412 103.898,280.369 123.066,280.951 L123.066,317.812 C70.802,317.812 39.955,299.912 39.955,251.578 L39.955,213.195 C39.955,188.648 20.455,177.658 0.601,177.658 L0.601,140.342 C20.455,140.342 39.955,129.353 39.955,104.806 L39.955,66.422 C39.955,18.089 70.803,0.188 123.066,0.188 L123.066,37.049 C103.898,37.631 81.519,45.588 81.519,70.544 L81.519,105 C81.519,134.5 68.954,151.25 51.269,159 L51.269,159 Z M272.481,105 L272.481,70.544 C272.481,45.588 250.102,37.631 230.934,37.049 L230.934,0.188 C283.198,0.188 314.045,18.089 314.045,66.422 L314.045,104.806 C314.045,129.353 333.545,140.342 353.399,140.342 L353.399,177.658 C333.545,177.658 314.045,188.648 314.045,213.195 L314.045,251.578 C314.045,299.912 283.197,317.812 230.934,317.812 L230.934,280.951 C250.102,280.369 272.481,272.412 272.481,247.457 L272.481,213 C272.481,183.5 285.045,166.75 302.731,159 C285.046,151.25 272.481,134.5 272.481,105 L272.481,105 Z M204.546,175.288 L204.546,206.442 C204.546,234.293 186.946,256.827 161.302,261.899 L156.442,251.395 C168.318,246.92 175.85,232.55 175.85,221.755 L155.804,221.755 L155.804,175.287 L204.546,175.287 L204.546,175.288 Z M204.546,75.051 L155.804,75.051 L155.804,123.872 L204.546,123.872 L204.546,75.051 L204.546,75.051 Z" id="javascript-code-icon" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
|
| 9 |
+
</g>
|
| 10 |
+
</svg>
|
assets/img/icon16.png
ADDED
|
Binary file
|
assets/img/snail-banner.jpg
DELETED
|
Binary file
|
assets/img/snail-banner@2x.jpg
DELETED
|
Binary file
|
assets/js/script.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
| 4 |
var bucketNamePattern = /[^a-z0-9.-]/;
|
| 5 |
var refreshBucketListOnLoad = false;
|
| 6 |
|
|
|
|
| 7 |
var $tabs = $( '.as3cf-tab' );
|
|
|
|
| 8 |
var $activeTab;
|
| 9 |
|
| 10 |
/**
|
|
@@ -68,7 +70,7 @@
|
|
| 68 |
$activeTab.show();
|
| 69 |
$( '.nav-tab' ).removeClass( 'nav-tab-active' );
|
| 70 |
$( 'a.nav-tab[data-tab="' + hash + '"]' ).addClass( 'nav-tab-active' );
|
| 71 |
-
$( '.
|
| 72 |
if ( $activeTab.data( 'prefix' ) ) {
|
| 73 |
as3cfModal.prefix = $activeTab.data( 'prefix' );
|
| 74 |
}
|
|
@@ -294,6 +296,8 @@
|
|
| 294 |
|
| 295 |
// Make sure the bucket list will refresh the next time the modal loads
|
| 296 |
refreshBucketListOnLoad = true;
|
|
|
|
|
|
|
| 297 |
} else {
|
| 298 |
that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-manual' );
|
| 299 |
}
|
|
@@ -358,6 +362,8 @@
|
|
| 358 |
if ( 'undefined' !== typeof data[ 'success' ] ) {
|
| 359 |
that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
|
| 360 |
$( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );
|
|
|
|
|
|
|
| 361 |
} else {
|
| 362 |
that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-select' );
|
| 363 |
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
|
|
@@ -518,6 +524,8 @@
|
|
| 518 |
|
| 519 |
// Make sure the bucket list will refresh the next time the modal loads
|
| 520 |
refreshBucketListOnLoad = true;
|
|
|
|
|
|
|
| 521 |
} else {
|
| 522 |
that.showError( as3cf.strings.create_bucket_error, data[ 'error' ], 'as3cf-bucket-create' );
|
| 523 |
}
|
|
@@ -571,6 +579,35 @@
|
|
| 571 |
|
| 572 |
};
|
| 573 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 574 |
/**
|
| 575 |
* Get the link to the bucket on the AWS Console and update the DOM
|
| 576 |
*
|
|
@@ -667,6 +704,85 @@
|
|
| 667 |
$( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] );
|
| 668 |
}
|
| 669 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
$( document ).ready( function() {
|
| 671 |
|
| 672 |
// Tabs
|
|
@@ -687,8 +803,8 @@
|
|
| 687 |
};
|
| 688 |
|
| 689 |
// Move any compatibility errors below the nav tabs
|
| 690 |
-
var $navTabs = $( '.
|
| 691 |
-
$( '.
|
| 692 |
|
| 693 |
// Settings
|
| 694 |
// --------------------
|
|
@@ -791,17 +907,17 @@
|
|
| 791 |
$( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );
|
| 792 |
|
| 793 |
// Action click handlers
|
| 794 |
-
$
|
| 795 |
e.preventDefault();
|
| 796 |
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' ).show().siblings().hide();
|
| 797 |
} );
|
| 798 |
-
$
|
| 799 |
e.preventDefault();
|
| 800 |
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).show().siblings().hide();
|
| 801 |
as3cf.buckets.loadList( refreshBucketListOnLoad );
|
| 802 |
refreshBucketListOnLoad = false;
|
| 803 |
} );
|
| 804 |
-
$
|
| 805 |
e.preventDefault();
|
| 806 |
|
| 807 |
// Reset create bucket modal
|
|
@@ -810,27 +926,27 @@
|
|
| 810 |
|
| 811 |
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' ).show().siblings().hide();
|
| 812 |
} );
|
| 813 |
-
$
|
| 814 |
e.preventDefault();
|
| 815 |
as3cf.buckets.resetModal();
|
| 816 |
} );
|
| 817 |
-
$
|
| 818 |
e.preventDefault();
|
| 819 |
as3cf.buckets.saveManual();
|
| 820 |
} );
|
| 821 |
-
$
|
| 822 |
e.preventDefault();
|
| 823 |
as3cf.buckets.create();
|
| 824 |
} );
|
| 825 |
|
| 826 |
// Bucket list refresh handler
|
| 827 |
-
$
|
| 828 |
e.preventDefault();
|
| 829 |
as3cf.buckets.loadList( true );
|
| 830 |
} );
|
| 831 |
|
| 832 |
// Bucket list click handler
|
| 833 |
-
$
|
| 834 |
e.preventDefault();
|
| 835 |
as3cf.buckets.saveSelected( $( this ) );
|
| 836 |
} );
|
|
@@ -844,7 +960,7 @@
|
|
| 844 |
} );
|
| 845 |
|
| 846 |
// Modal open
|
| 847 |
-
$
|
| 848 |
if ( '.as3cf-bucket-container.' + as3cfModal.prefix === target ) {
|
| 849 |
|
| 850 |
// Reset modal
|
|
@@ -862,7 +978,7 @@
|
|
| 862 |
as3cf.buckets.disabledButtons();
|
| 863 |
|
| 864 |
// Validate bucket name on create
|
| 865 |
-
$
|
| 866 |
var bucketName = $( this ).val();
|
| 867 |
var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
|
| 868 |
|
|
@@ -875,7 +991,7 @@
|
|
| 875 |
} );
|
| 876 |
|
| 877 |
// Check bucket name length on manual
|
| 878 |
-
$
|
| 879 |
var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
|
| 880 |
|
| 881 |
if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) {
|
|
@@ -885,6 +1001,21 @@
|
|
| 885 |
}
|
| 886 |
} );
|
| 887 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 888 |
} );
|
| 889 |
|
| 890 |
})( jQuery, as3cfModal );
|
| 4 |
var bucketNamePattern = /[^a-z0-9.-]/;
|
| 5 |
var refreshBucketListOnLoad = false;
|
| 6 |
|
| 7 |
+
var $body = $( 'body' );
|
| 8 |
var $tabs = $( '.as3cf-tab' );
|
| 9 |
+
var $settings = $( '.as3cf-settings' );
|
| 10 |
var $activeTab;
|
| 11 |
|
| 12 |
/**
|
| 70 |
$activeTab.show();
|
| 71 |
$( '.nav-tab' ).removeClass( 'nav-tab-active' );
|
| 72 |
$( 'a.nav-tab[data-tab="' + hash + '"]' ).addClass( 'nav-tab-active' );
|
| 73 |
+
$( '.as3cf-main' ).data( 'tab', hash );
|
| 74 |
if ( $activeTab.data( 'prefix' ) ) {
|
| 75 |
as3cfModal.prefix = $activeTab.data( 'prefix' );
|
| 76 |
}
|
| 296 |
|
| 297 |
// Make sure the bucket list will refresh the next time the modal loads
|
| 298 |
refreshBucketListOnLoad = true;
|
| 299 |
+
|
| 300 |
+
as3cf.showSettingsSavedNotice();
|
| 301 |
} else {
|
| 302 |
that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-manual' );
|
| 303 |
}
|
| 362 |
if ( 'undefined' !== typeof data[ 'success' ] ) {
|
| 363 |
that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
|
| 364 |
$( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );
|
| 365 |
+
|
| 366 |
+
as3cf.showSettingsSavedNotice();
|
| 367 |
} else {
|
| 368 |
that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-select' );
|
| 369 |
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
|
| 524 |
|
| 525 |
// Make sure the bucket list will refresh the next time the modal loads
|
| 526 |
refreshBucketListOnLoad = true;
|
| 527 |
+
|
| 528 |
+
as3cf.showSettingsSavedNotice();
|
| 529 |
} else {
|
| 530 |
that.showError( as3cf.strings.create_bucket_error, data[ 'error' ], 'as3cf-bucket-create' );
|
| 531 |
}
|
| 579 |
|
| 580 |
};
|
| 581 |
|
| 582 |
+
/**
|
| 583 |
+
* Reload the page, and show the persistent updated notice.
|
| 584 |
+
*
|
| 585 |
+
* Intended for use on plugin settings page.
|
| 586 |
+
*/
|
| 587 |
+
as3cf.reloadUpdated = function() {
|
| 588 |
+
var url = location.pathname + location.search;
|
| 589 |
+
|
| 590 |
+
if ( ! location.search.match( /[?&]updated=/ ) ) {
|
| 591 |
+
url += '&updated=1';
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
url += location.hash;
|
| 595 |
+
|
| 596 |
+
location.assign( url );
|
| 597 |
+
};
|
| 598 |
+
|
| 599 |
+
/**
|
| 600 |
+
* Show the standard "Settings saved." notice if not already visible.
|
| 601 |
+
*/
|
| 602 |
+
as3cf.showSettingsSavedNotice = function() {
|
| 603 |
+
if ( 0 < $( '#setting-error-settings_updated:visible' ).length || 0 < $( '#as3cf-settings_updated:visible' ).length ) {
|
| 604 |
+
return;
|
| 605 |
+
}
|
| 606 |
+
var settingsUpdatedNotice = '<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>' + as3cf.strings.settings_saved + '</strong></p></div>';
|
| 607 |
+
$( 'h2.nav-tab-wrapper' ).after( settingsUpdatedNotice );
|
| 608 |
+
$( document ).trigger( 'wp-updates-notice-added' ); // Hack to run WP Core's makeNoticesDismissible() function.
|
| 609 |
+
};
|
| 610 |
+
|
| 611 |
/**
|
| 612 |
* Get the link to the bucket on the AWS Console and update the DOM
|
| 613 |
*
|
| 704 |
$( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] );
|
| 705 |
}
|
| 706 |
|
| 707 |
+
/**
|
| 708 |
+
* Access Keys API object
|
| 709 |
+
* @constructor
|
| 710 |
+
*/
|
| 711 |
+
var AccessKeys = function() {
|
| 712 |
+
this.$key = $settings.find( 'input[name="aws-access-key-id"]' );
|
| 713 |
+
this.$secret = $settings.find( 'input[name="aws-secret-access-key"]' );
|
| 714 |
+
this.$spinner = $settings.find( '[data-as3cf-aws-keys-spinner]' );
|
| 715 |
+
this.$feedback = $settings.find( '[data-as3cf-aws-keys-feedback]' );
|
| 716 |
+
};
|
| 717 |
+
|
| 718 |
+
/**
|
| 719 |
+
* Set the access keys using the values in the settings fields.
|
| 720 |
+
*/
|
| 721 |
+
AccessKeys.prototype.set = function() {
|
| 722 |
+
this.sendRequest( 'set', {
|
| 723 |
+
'aws-access-key-id': this.$key.val(),
|
| 724 |
+
'aws-secret-access-key': this.$secret.val()
|
| 725 |
+
} ).done( function( response ) {
|
| 726 |
+
if ( response.success ) {
|
| 727 |
+
this.$secret.val( as3cf.strings.not_shown_placeholder );
|
| 728 |
+
}
|
| 729 |
+
}.bind( this ) );
|
| 730 |
+
};
|
| 731 |
+
|
| 732 |
+
/**
|
| 733 |
+
* Remove the access keys from the database and clear the fields.
|
| 734 |
+
*/
|
| 735 |
+
AccessKeys.prototype.remove = function() {
|
| 736 |
+
this.sendRequest( 'remove' )
|
| 737 |
+
.done( function( response ) {
|
| 738 |
+
if ( response.success ) {
|
| 739 |
+
this.$key.val( '' );
|
| 740 |
+
this.$secret.val( '' );
|
| 741 |
+
}
|
| 742 |
+
}.bind( this ) )
|
| 743 |
+
;
|
| 744 |
+
};
|
| 745 |
+
|
| 746 |
+
/**
|
| 747 |
+
* Send the request to the server to update the access keys.
|
| 748 |
+
*
|
| 749 |
+
* @param {string} action The action to perform with the keys
|
| 750 |
+
* @param {undefined|Object} params Extra parameters to send with the request
|
| 751 |
+
*
|
| 752 |
+
* @returns {jqXHR}
|
| 753 |
+
*/
|
| 754 |
+
AccessKeys.prototype.sendRequest = function( action, params ) {
|
| 755 |
+
var data = {
|
| 756 |
+
action: 'as3cf-aws-keys-' + action,
|
| 757 |
+
_ajax_nonce: as3cf.nonces[ 'aws_keys_' + action ]
|
| 758 |
+
};
|
| 759 |
+
|
| 760 |
+
if ( _.isObject( params ) ) {
|
| 761 |
+
data = _.extend( data, params );
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
+
this.$spinner.addClass( 'is-active' );
|
| 765 |
+
|
| 766 |
+
return $.post( ajaxurl, data )
|
| 767 |
+
.done( function( response ) {
|
| 768 |
+
this.$feedback
|
| 769 |
+
.toggleClass( 'notice-success', response.success )
|
| 770 |
+
.toggleClass( 'notice-error', ! response.success );
|
| 771 |
+
|
| 772 |
+
if ( response.data && response.data.message ) {
|
| 773 |
+
this.$feedback.html( '<p>' + response.data.message + '</p>' ).show();
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
if ( response.success ) {
|
| 777 |
+
as3cf.reloadUpdated();
|
| 778 |
+
}
|
| 779 |
+
}.bind( this ) )
|
| 780 |
+
.always( function() {
|
| 781 |
+
this.$spinner.removeClass( 'is-active' );
|
| 782 |
+
}.bind( this ) )
|
| 783 |
+
;
|
| 784 |
+
};
|
| 785 |
+
|
| 786 |
$( document ).ready( function() {
|
| 787 |
|
| 788 |
// Tabs
|
| 803 |
};
|
| 804 |
|
| 805 |
// Move any compatibility errors below the nav tabs
|
| 806 |
+
var $navTabs = $( '.as3cf-main .nav-tab-wrapper' );
|
| 807 |
+
$( '.as3cf-compatibility-notice, div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $navTabs );
|
| 808 |
|
| 809 |
// Settings
|
| 810 |
// --------------------
|
| 907 |
$( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );
|
| 908 |
|
| 909 |
// Action click handlers
|
| 910 |
+
$body.on( 'click', '.bucket-action-manual', function( e ) {
|
| 911 |
e.preventDefault();
|
| 912 |
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' ).show().siblings().hide();
|
| 913 |
} );
|
| 914 |
+
$body.on( 'click', '.bucket-action-browse', function( e ) {
|
| 915 |
e.preventDefault();
|
| 916 |
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).show().siblings().hide();
|
| 917 |
as3cf.buckets.loadList( refreshBucketListOnLoad );
|
| 918 |
refreshBucketListOnLoad = false;
|
| 919 |
} );
|
| 920 |
+
$body.on( 'click', '.bucket-action-create', function( e ) {
|
| 921 |
e.preventDefault();
|
| 922 |
|
| 923 |
// Reset create bucket modal
|
| 926 |
|
| 927 |
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' ).show().siblings().hide();
|
| 928 |
} );
|
| 929 |
+
$body.on( 'click', '.bucket-action-cancel', function( e ) {
|
| 930 |
e.preventDefault();
|
| 931 |
as3cf.buckets.resetModal();
|
| 932 |
} );
|
| 933 |
+
$body.on( 'click', '.bucket-action-save', function( e ) {
|
| 934 |
e.preventDefault();
|
| 935 |
as3cf.buckets.saveManual();
|
| 936 |
} );
|
| 937 |
+
$body.on( 'click', '.as3cf-create-bucket-form button[type="submit"]', function( e ) {
|
| 938 |
e.preventDefault();
|
| 939 |
as3cf.buckets.create();
|
| 940 |
} );
|
| 941 |
|
| 942 |
// Bucket list refresh handler
|
| 943 |
+
$body.on( 'click', '.bucket-action-refresh', function( e ) {
|
| 944 |
e.preventDefault();
|
| 945 |
as3cf.buckets.loadList( true );
|
| 946 |
} );
|
| 947 |
|
| 948 |
// Bucket list click handler
|
| 949 |
+
$body.on( 'click', '.as3cf-bucket-list a', function( e ) {
|
| 950 |
e.preventDefault();
|
| 951 |
as3cf.buckets.saveSelected( $( this ) );
|
| 952 |
} );
|
| 960 |
} );
|
| 961 |
|
| 962 |
// Modal open
|
| 963 |
+
$body.on( 'as3cf-modal-open', function( e, target ) {
|
| 964 |
if ( '.as3cf-bucket-container.' + as3cfModal.prefix === target ) {
|
| 965 |
|
| 966 |
// Reset modal
|
| 978 |
as3cf.buckets.disabledButtons();
|
| 979 |
|
| 980 |
// Validate bucket name on create
|
| 981 |
+
$body.on( 'input keyup', '.as3cf-create-bucket-form .as3cf-bucket-name', function( e ) {
|
| 982 |
var bucketName = $( this ).val();
|
| 983 |
var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
|
| 984 |
|
| 991 |
} );
|
| 992 |
|
| 993 |
// Check bucket name length on manual
|
| 994 |
+
$body.on( 'input keyup', '.as3cf-manual-save-bucket-form .as3cf-bucket-name', function( e ) {
|
| 995 |
var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
|
| 996 |
|
| 997 |
if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) {
|
| 1001 |
}
|
| 1002 |
} );
|
| 1003 |
|
| 1004 |
+
$settings
|
| 1005 |
+
.on( 'click', '[data-as3cf-toggle-access-keys-form]', function( event ) {
|
| 1006 |
+
event.preventDefault();
|
| 1007 |
+
$( '#as3cf_access_keys' ).toggle();
|
| 1008 |
+
} )
|
| 1009 |
+
.on( 'click', '[data-as3cf-aws-keys-action]', function( event ) {
|
| 1010 |
+
event.preventDefault();
|
| 1011 |
+
var action = $( this ).data( 'as3cfAwsKeysAction' );
|
| 1012 |
+
var api = new AccessKeys();
|
| 1013 |
+
|
| 1014 |
+
if ( 'function' === typeof api[action] ) {
|
| 1015 |
+
api[action]();
|
| 1016 |
+
}
|
| 1017 |
+
} )
|
| 1018 |
+
;
|
| 1019 |
} );
|
| 1020 |
|
| 1021 |
})( jQuery, as3cfModal );
|
assets/js/script.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
!function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=k.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.prop("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+k.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.prop("disabled",!0)):(c.hide(),d.prop("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=k.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e="&prefix="+encodeURIComponent(e));var f=as3cf.aws_bucket_link+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?a(".as3cf-url-preview").html(b.url):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}var k,l={},m=/[^a-z0-9.-]/,n=!1,o=a(".as3cf-tab");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),o.hide(),k=a("#tab-"+c),k.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".aws-main").data("tab",c),k.data("prefix")&&(b.prefix=k.data("prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-list"),e=a("#"+b.prefix+"-bucket").val();if(!1===c&&d.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"),void this.scrollToSelected();d.html('<li class="loading">'+d.data("working")+"</li>");var f={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets},g=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:f,error:function(a,b,c){d.html(""),g.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,f){d.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),a(b.buckets).each(function(a,b){var c=b.Name===e?"selected":"";d.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),g.scrollToSelected()):g.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===k.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(n),n=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find("button[type=submit]"),f=d.val(),g=e.first().text();if(f===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),k.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),e.text(e.data("working")),e.prop("disabled",!0);var h={action:b.prefix+"-manual-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket},i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){e.text(g),i.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,h){e.text(g),e.prop("disabled",!1),"undefined"!=typeof c.success?(i.set(f,c.region,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+f+'"]').addClass("selected"),n=!0):i.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){var d=a(".as3cf-bucket-list");if(!this.bucketSelectLock){if(this.bucketSelectLock=!0,c.hasClass("selected"))return k.addClass("as3cf-has-bucket"),void b.close();var e=a(".as3cf-bucket-list a.selected").data("bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),d.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var f=c.data("bucket"),g={action:b.prefix+"-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket},h=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:g,error:function(b,c,f){d.removeClass("saving"),h.showError(as3cf.strings.save_bucket_error,f,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected")},success:function(g,i,j){c.find(".spinner").hide().css("visibility","hidden"),d.removeClass("saving"),"undefined"!=typeof g.success?(h.set(f,g.region,g.can_write),a("#"+b.prefix+"-bucket-select").val("")):(h.showError(as3cf.strings.save_bucket_error,g.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").prop("disabled",!0):c.find("button[type=submit]").prop("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" —"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,h,i){var j=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),m=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===m.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var n=k.attr("id");l[n]=c(n)}a(".as3cf-error.fatal").hide(),m.text(e),j.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!i),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){k.trigger("bucket-change",[i]),as3cf.buckets.bucketSelectLock=!1})},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").prop("selected",!1),d.val(""),f.prop("disabled",!0),n=!0):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==m.test(a)},updateNameNotice:function(b){var c=null;!0===m.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},a(document).ready(function(){j(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),j()};var m=a(".wrap.aws-main .nav-tab-wrapper");a(".aws-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),o.length&&o.each(function(a,b){l[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(l)){var b=k.attr("id");return c(b)!==l[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),o.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+k.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.prop("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),a("body").on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),a("body").on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(n),n=!1}),a("body").on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),a("body").on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),a("body").on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),a("body").on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),a("body").on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),a("body").on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),a("body").on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),a("body").on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").prop("disabled",!1):e.find("button[type=submit]").prop("disabled",!0),as3cf.buckets.updateNameNotice(d)}),a("body").on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)})})}(jQuery,as3cfModal);
|
| 1 |
+
!function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=k.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.prop("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+k.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.prop("disabled",!0)):(c.hide(),d.prop("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=k.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e="&prefix="+encodeURIComponent(e));var f=as3cf.aws_bucket_link+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?a(".as3cf-url-preview").html(b.url):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}var k,l={},m=/[^a-z0-9.-]/,n=!1,o=a("body"),p=a(".as3cf-tab"),q=a(".as3cf-settings");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),p.hide(),k=a("#tab-"+c),k.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".as3cf-main").data("tab",c),k.data("prefix")&&(b.prefix=k.data("prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-list"),e=a("#"+b.prefix+"-bucket").val();if(!1===c&&d.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"),void this.scrollToSelected();d.html('<li class="loading">'+d.data("working")+"</li>");var f={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets},g=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:f,error:function(a,b,c){d.html(""),g.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,f){d.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),a(b.buckets).each(function(a,b){var c=b.Name===e?"selected":"";d.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),g.scrollToSelected()):g.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===k.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(n),n=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find("button[type=submit]"),f=d.val(),g=e.first().text();if(f===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),k.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),e.text(e.data("working")),e.prop("disabled",!0);var h={action:b.prefix+"-manual-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket},i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){e.text(g),i.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,h){e.text(g),e.prop("disabled",!1),"undefined"!=typeof c.success?(i.set(f,c.region,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+f+'"]').addClass("selected"),n=!0,as3cf.showSettingsSavedNotice()):i.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){var d=a(".as3cf-bucket-list");if(!this.bucketSelectLock){if(this.bucketSelectLock=!0,c.hasClass("selected"))return k.addClass("as3cf-has-bucket"),void b.close();var e=a(".as3cf-bucket-list a.selected").data("bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),d.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var f=c.data("bucket"),g={action:b.prefix+"-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket},h=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:g,error:function(b,c,f){d.removeClass("saving"),h.showError(as3cf.strings.save_bucket_error,f,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected")},success:function(g,i,j){c.find(".spinner").hide().css("visibility","hidden"),d.removeClass("saving"),"undefined"!=typeof g.success?(h.set(f,g.region,g.can_write),a("#"+b.prefix+"-bucket-select").val(""),as3cf.showSettingsSavedNotice()):(h.showError(as3cf.strings.save_bucket_error,g.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").prop("disabled",!0):c.find("button[type=submit]").prop("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" —"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,h,i){var j=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),m=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===m.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var n=k.attr("id");l[n]=c(n)}a(".as3cf-error.fatal").hide(),m.text(e),j.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!i),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){k.trigger("bucket-change",[i]),as3cf.buckets.bucketSelectLock=!1})},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").prop("selected",!1),d.val(""),f.prop("disabled",!0),n=!0,as3cf.showSettingsSavedNotice()):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==m.test(a)},updateNameNotice:function(b){var c=null;!0===m.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},as3cf.reloadUpdated=function(){var a=location.pathname+location.search;location.search.match(/[?&]updated=/)||(a+="&updated=1"),a+=location.hash,location.assign(a)},as3cf.showSettingsSavedNotice=function(){if(!(0<a("#setting-error-settings_updated:visible").length||0<a("#as3cf-settings_updated:visible").length)){var b='<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>'+as3cf.strings.settings_saved+"</strong></p></div>";a("h2.nav-tab-wrapper").after(b),a(document).trigger("wp-updates-notice-added")}};var r=function(){this.$key=q.find('input[name="aws-access-key-id"]'),this.$secret=q.find('input[name="aws-secret-access-key"]'),this.$spinner=q.find("[data-as3cf-aws-keys-spinner]"),this.$feedback=q.find("[data-as3cf-aws-keys-feedback]")};r.prototype.set=function(){this.sendRequest("set",{"aws-access-key-id":this.$key.val(),"aws-secret-access-key":this.$secret.val()}).done(function(a){a.success&&this.$secret.val(as3cf.strings.not_shown_placeholder)}.bind(this))},r.prototype.remove=function(){this.sendRequest("remove").done(function(a){a.success&&(this.$key.val(""),this.$secret.val(""))}.bind(this))},r.prototype.sendRequest=function(b,c){var d={action:"as3cf-aws-keys-"+b,_ajax_nonce:as3cf.nonces["aws_keys_"+b]};return _.isObject(c)&&(d=_.extend(d,c)),this.$spinner.addClass("is-active"),a.post(ajaxurl,d).done(function(a){this.$feedback.toggleClass("notice-success",a.success).toggleClass("notice-error",!a.success),a.data&&a.data.message&&this.$feedback.html("<p>"+a.data.message+"</p>").show(),a.success&&as3cf.reloadUpdated()}.bind(this)).always(function(){this.$spinner.removeClass("is-active")}.bind(this))},a(document).ready(function(){j(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),j()};var m=a(".as3cf-main .nav-tab-wrapper");a(".as3cf-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),p.length&&p.each(function(a,b){l[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(l)){var b=k.attr("id");return c(b)!==l[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),p.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+k.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.prop("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),o.on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),o.on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(n),n=!1}),o.on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),o.on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),o.on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),o.on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),o.on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),o.on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),o.on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),o.on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").prop("disabled",!1):e.find("button[type=submit]").prop("disabled",!0),as3cf.buckets.updateNameNotice(d)}),o.on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}),q.on("click","[data-as3cf-toggle-access-keys-form]",function(b){b.preventDefault(),a("#as3cf_access_keys").toggle()}).on("click","[data-as3cf-aws-keys-action]",function(b){b.preventDefault();var c=a(this).data("as3cfAwsKeysAction"),d=new r;"function"==typeof d[c]&&d[c]()})})}(jQuery,as3cfModal);
|
assets/sass/notice.scss
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
* Common as3cf-notice styles.
|
| 3 |
*/
|
| 4 |
.as3cf-notice,
|
| 5 |
-
.
|
| 6 |
p {
|
| 7 |
max-width: 800px;
|
| 8 |
}
|
|
@@ -14,3 +14,7 @@
|
|
| 14 |
.as3cf-license-notice p:not(.as3cf-before):before {
|
| 15 |
display: none;
|
| 16 |
}
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* Common as3cf-notice styles.
|
| 3 |
*/
|
| 4 |
.as3cf-notice,
|
| 5 |
+
.as3cf-compatibility-notice {
|
| 6 |
p {
|
| 7 |
max-width: 800px;
|
| 8 |
}
|
| 14 |
.as3cf-license-notice p:not(.as3cf-before):before {
|
| 15 |
display: none;
|
| 16 |
}
|
| 17 |
+
|
| 18 |
+
.as3cf-notice-warning {
|
| 19 |
+
border-left-color: #ffba00;
|
| 20 |
+
}
|
assets/sass/styles.scss
CHANGED
|
@@ -1,7 +1,23 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
position: relative;
|
| 6 |
|
| 7 |
& > h1 {
|
|
@@ -9,8 +25,6 @@
|
|
| 9 |
}
|
| 10 |
|
| 11 |
.as3cf-notice, .as3cf-updated, .as3cf-error {
|
| 12 |
-
-webkit-box-sizing: border-box;
|
| 13 |
-
-moz-box-sizing: border-box;
|
| 14 |
box-sizing: border-box;
|
| 15 |
}
|
| 16 |
|
|
@@ -25,13 +39,20 @@
|
|
| 25 |
margin-top: 10px;
|
| 26 |
padding: 9px 0 0 5px;
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
a.nav-tab-active {
|
| 29 |
color: #464646;
|
| 30 |
cursor: default;
|
| 31 |
}
|
| 32 |
|
| 33 |
a:focus {
|
| 34 |
-
-webkit-box-shadow: none;
|
| 35 |
box-shadow: none;
|
| 36 |
}
|
| 37 |
}
|
|
@@ -65,8 +86,6 @@
|
|
| 65 |
.as3cf-notice, .error, .updated {
|
| 66 |
max-width: 650px;
|
| 67 |
margin-top: 15px;
|
| 68 |
-
-webkit-box-sizing: border-box;
|
| 69 |
-
-moz-box-sizing: border-box;
|
| 70 |
box-sizing: border-box;
|
| 71 |
}
|
| 72 |
|
|
@@ -76,6 +95,15 @@
|
|
| 76 |
display: block;
|
| 77 |
}
|
| 78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
/**
|
|
@@ -101,6 +129,21 @@
|
|
| 101 |
}
|
| 102 |
}
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
/**
|
| 105 |
* Settings
|
| 106 |
*/
|
|
@@ -130,8 +173,6 @@
|
|
| 130 |
padding: 20px 0 0;
|
| 131 |
max-width: 650px;
|
| 132 |
width: 100%;
|
| 133 |
-
-webkit-box-sizing: border-box;
|
| 134 |
-
-moz-box-sizing: border-box;
|
| 135 |
box-sizing: border-box;
|
| 136 |
|
| 137 |
.as3cf-url-preview {
|
|
@@ -173,7 +214,6 @@
|
|
| 173 |
padding: 2px;
|
| 174 |
overflow: hidden;
|
| 175 |
border-radius: 2px;
|
| 176 |
-
-webkit-border-radius: 2px;
|
| 177 |
background-color: #d4d3d3;
|
| 178 |
cursor: pointer;
|
| 179 |
|
|
@@ -183,8 +223,6 @@
|
|
| 183 |
|
| 184 |
span {
|
| 185 |
visibility: hidden;
|
| 186 |
-
-webkit-box-sizing: border-box;
|
| 187 |
-
-moz-box-sizing: border-box;
|
| 188 |
box-sizing: border-box;
|
| 189 |
float: left;
|
| 190 |
display: inline-block;
|
|
@@ -192,7 +230,6 @@
|
|
| 192 |
font-size: 12px;
|
| 193 |
line-height: 20px;
|
| 194 |
border-radius: 2px;
|
| 195 |
-
-webkit-border-radius: 2px;
|
| 196 |
font-weight: bold;
|
| 197 |
padding: 4px 8px;
|
| 198 |
background: #fff;
|
|
@@ -241,7 +278,6 @@
|
|
| 241 |
h3 {
|
| 242 |
font-weight: normal;
|
| 243 |
text-transform: uppercase;
|
| 244 |
-
margin: 15px 0;
|
| 245 |
}
|
| 246 |
|
| 247 |
.form-table {
|
|
@@ -273,12 +309,6 @@
|
|
| 273 |
margin-top: 0;
|
| 274 |
}
|
| 275 |
}
|
| 276 |
-
|
| 277 |
-
&:first-of-type {
|
| 278 |
-
td {
|
| 279 |
-
padding-top: 5px;
|
| 280 |
-
}
|
| 281 |
-
}
|
| 282 |
}
|
| 283 |
|
| 284 |
tr.as3cf-bucket-setting .as3cf-defined-in-config {
|
|
@@ -338,8 +368,6 @@
|
|
| 338 |
margin-left: -250px;
|
| 339 |
padding: 10px;
|
| 340 |
width: 500px;
|
| 341 |
-
-webkit-border-radius: 3px;
|
| 342 |
-
-moz-border-radius: 3px;
|
| 343 |
border-radius: 3px;
|
| 344 |
background-color: #000;
|
| 345 |
background-color: hsla(0, 0%, 20%, 0.9);
|
|
@@ -381,6 +409,7 @@
|
|
| 381 |
padding: 2px 5px;
|
| 382 |
margin: 0 0 5px 5px;
|
| 383 |
float: right;
|
|
|
|
| 384 |
}
|
| 385 |
|
| 386 |
.as3cf-defined-setting {
|
|
@@ -414,6 +443,10 @@
|
|
| 414 |
display: none;
|
| 415 |
}
|
| 416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
.as3cf-bucket-container {
|
| 418 |
display: block;
|
| 419 |
}
|
|
@@ -439,7 +472,6 @@
|
|
| 439 |
}
|
| 440 |
|
| 441 |
a:focus {
|
| 442 |
-
-webkit-box-shadow: none;
|
| 443 |
box-shadow: none;
|
| 444 |
outline: none;
|
| 445 |
}
|
|
@@ -535,14 +567,47 @@
|
|
| 535 |
}
|
| 536 |
}
|
| 537 |
|
| 538 |
-
.as3cf-tab {
|
| 539 |
-
display: none;
|
| 540 |
-
}
|
| 541 |
-
|
| 542 |
#tab-media {
|
| 543 |
display: block;
|
| 544 |
}
|
| 545 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
#tab-support {
|
| 547 |
min-height: 900px;
|
| 548 |
.as3cf-sidebar {
|
|
@@ -553,6 +618,10 @@
|
|
| 553 |
border-bottom: 1px solid #ccc;
|
| 554 |
padding-bottom: 20px;
|
| 555 |
margin-bottom: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 556 |
}
|
| 557 |
|
| 558 |
.debug {
|
|
@@ -750,7 +819,7 @@
|
|
| 750 |
}
|
| 751 |
}
|
| 752 |
|
| 753 |
-
.
|
| 754 |
clear: both;
|
| 755 |
margin: 5px 20px 5px 0;
|
| 756 |
}
|
|
@@ -780,3 +849,109 @@
|
|
| 780 |
color: #dc3232;
|
| 781 |
}
|
| 782 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
$aws_orange: #f7a80d;
|
| 2 |
+
$as3cf_assets: #0769ad;
|
| 3 |
+
|
| 4 |
+
.as3cf-content,
|
| 5 |
+
.as3cf-updated,
|
| 6 |
+
.as3cf-compatibility-notice {
|
| 7 |
+
box-sizing: border-box;
|
| 8 |
+
max-width: 650px;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.settings_page_amazon-s3-and-cloudfront {
|
| 12 |
+
.error,
|
| 13 |
+
.notice,
|
| 14 |
+
.updated {
|
| 15 |
+
box-sizing: border-box;
|
| 16 |
+
max-width: 650px;
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.as3cf-main.wrap {
|
| 21 |
position: relative;
|
| 22 |
|
| 23 |
& > h1 {
|
| 25 |
}
|
| 26 |
|
| 27 |
.as3cf-notice, .as3cf-updated, .as3cf-error {
|
|
|
|
|
|
|
| 28 |
box-sizing: border-box;
|
| 29 |
}
|
| 30 |
|
| 39 |
margin-top: 10px;
|
| 40 |
padding: 9px 0 0 5px;
|
| 41 |
|
| 42 |
+
.nav-tab-container {
|
| 43 |
+
float: right;
|
| 44 |
+
|
| 45 |
+
:last-child {
|
| 46 |
+
margin-right: 5px;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
a.nav-tab-active {
|
| 51 |
color: #464646;
|
| 52 |
cursor: default;
|
| 53 |
}
|
| 54 |
|
| 55 |
a:focus {
|
|
|
|
| 56 |
box-shadow: none;
|
| 57 |
}
|
| 58 |
}
|
| 86 |
.as3cf-notice, .error, .updated {
|
| 87 |
max-width: 650px;
|
| 88 |
margin-top: 15px;
|
|
|
|
|
|
|
| 89 |
box-sizing: border-box;
|
| 90 |
}
|
| 91 |
|
| 95 |
display: block;
|
| 96 |
}
|
| 97 |
}
|
| 98 |
+
|
| 99 |
+
.alignleft {
|
| 100 |
+
margin-right: 20px;
|
| 101 |
+
margin-bottom: 20px;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.spinner {
|
| 105 |
+
min-width: 20px;
|
| 106 |
+
}
|
| 107 |
}
|
| 108 |
|
| 109 |
/**
|
| 129 |
}
|
| 130 |
}
|
| 131 |
|
| 132 |
+
.as3cf-content {
|
| 133 |
+
> section {
|
| 134 |
+
margin-bottom: 20px;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
> section + section.as3cf-access-keys {
|
| 138 |
+
padding-top: 20px;
|
| 139 |
+
border-top: 1px solid #d3d3d3;
|
| 140 |
+
|
| 141 |
+
.as3cf-section-heading {
|
| 142 |
+
margin-top: 0;
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
/**
|
| 148 |
* Settings
|
| 149 |
*/
|
| 173 |
padding: 20px 0 0;
|
| 174 |
max-width: 650px;
|
| 175 |
width: 100%;
|
|
|
|
|
|
|
| 176 |
box-sizing: border-box;
|
| 177 |
|
| 178 |
.as3cf-url-preview {
|
| 214 |
padding: 2px;
|
| 215 |
overflow: hidden;
|
| 216 |
border-radius: 2px;
|
|
|
|
| 217 |
background-color: #d4d3d3;
|
| 218 |
cursor: pointer;
|
| 219 |
|
| 223 |
|
| 224 |
span {
|
| 225 |
visibility: hidden;
|
|
|
|
|
|
|
| 226 |
box-sizing: border-box;
|
| 227 |
float: left;
|
| 228 |
display: inline-block;
|
| 230 |
font-size: 12px;
|
| 231 |
line-height: 20px;
|
| 232 |
border-radius: 2px;
|
|
|
|
| 233 |
font-weight: bold;
|
| 234 |
padding: 4px 8px;
|
| 235 |
background: #fff;
|
| 278 |
h3 {
|
| 279 |
font-weight: normal;
|
| 280 |
text-transform: uppercase;
|
|
|
|
| 281 |
}
|
| 282 |
|
| 283 |
.form-table {
|
| 309 |
margin-top: 0;
|
| 310 |
}
|
| 311 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
}
|
| 313 |
|
| 314 |
tr.as3cf-bucket-setting .as3cf-defined-in-config {
|
| 368 |
margin-left: -250px;
|
| 369 |
padding: 10px;
|
| 370 |
width: 500px;
|
|
|
|
|
|
|
| 371 |
border-radius: 3px;
|
| 372 |
background-color: #000;
|
| 373 |
background-color: hsla(0, 0%, 20%, 0.9);
|
| 409 |
padding: 2px 5px;
|
| 410 |
margin: 0 0 5px 5px;
|
| 411 |
float: right;
|
| 412 |
+
white-space: nowrap;
|
| 413 |
}
|
| 414 |
|
| 415 |
.as3cf-defined-setting {
|
| 443 |
display: none;
|
| 444 |
}
|
| 445 |
|
| 446 |
+
.as3cf-bucket-setting td {
|
| 447 |
+
padding-top: 5px;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
.as3cf-bucket-container {
|
| 451 |
display: block;
|
| 452 |
}
|
| 472 |
}
|
| 473 |
|
| 474 |
a:focus {
|
|
|
|
| 475 |
box-shadow: none;
|
| 476 |
outline: none;
|
| 477 |
}
|
| 567 |
}
|
| 568 |
}
|
| 569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
#tab-media {
|
| 571 |
display: block;
|
| 572 |
}
|
| 573 |
|
| 574 |
+
#tab-settings {
|
| 575 |
+
.as3cf-field-wrap {
|
| 576 |
+
display: flex;
|
| 577 |
+
align-items: center;
|
| 578 |
+
|
| 579 |
+
input {
|
| 580 |
+
width: 100%;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
button, .as3cf-defined-in-config {
|
| 584 |
+
margin-left: 20px;
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
.as3cf-defined-in-config {
|
| 588 |
+
display: none;
|
| 589 |
+
margin-bottom: 0;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
&.as3cf-defined {
|
| 593 |
+
button {
|
| 594 |
+
display: none;
|
| 595 |
+
}
|
| 596 |
+
.as3cf-defined-in-config {
|
| 597 |
+
display: inline-block;
|
| 598 |
+
}
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
&.as3cf-saved-field .as3cf-activate-licence {
|
| 602 |
+
display: none;
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
&.as3cf-licence-not-entered .as3cf-remove-licence {
|
| 606 |
+
display: none;
|
| 607 |
+
}
|
| 608 |
+
}
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
#tab-support {
|
| 612 |
min-height: 900px;
|
| 613 |
.as3cf-sidebar {
|
| 618 |
border-bottom: 1px solid #ccc;
|
| 619 |
padding-bottom: 20px;
|
| 620 |
margin-bottom: 20px;
|
| 621 |
+
|
| 622 |
+
h3 {
|
| 623 |
+
font-size: 20px;
|
| 624 |
+
}
|
| 625 |
}
|
| 626 |
|
| 627 |
.debug {
|
| 819 |
}
|
| 820 |
}
|
| 821 |
|
| 822 |
+
.as3cf-compatibility-notice.error {
|
| 823 |
clear: both;
|
| 824 |
margin: 5px 20px 5px 0;
|
| 825 |
}
|
| 849 |
color: #dc3232;
|
| 850 |
}
|
| 851 |
}
|
| 852 |
+
|
| 853 |
+
.as3cf-need-help {
|
| 854 |
+
background-color: white;
|
| 855 |
+
font-size: 16px;
|
| 856 |
+
font-weight: bold;
|
| 857 |
+
padding: 1em;
|
| 858 |
+
|
| 859 |
+
a {
|
| 860 |
+
text-decoration: none;
|
| 861 |
+
}
|
| 862 |
+
}
|
| 863 |
+
|
| 864 |
+
.as3cf-aws-logo {
|
| 865 |
+
color: white;
|
| 866 |
+
background-color: $aws_orange;
|
| 867 |
+
padding: 1em;
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
.as3cf-settings {
|
| 871 |
+
h3 {
|
| 872 |
+
font-size: 20px;
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
p {
|
| 876 |
+
font-size: 14px;
|
| 877 |
+
}
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
.as3cf-addons,
|
| 881 |
+
.as3cf-tab .as3cf-compatibility-notice {
|
| 882 |
+
max-width: cover;
|
| 883 |
+
}
|
| 884 |
+
|
| 885 |
+
textarea.as3cf-access-key-constants-snippet.code {
|
| 886 |
+
width: 100%;
|
| 887 |
+
white-space: pre;
|
| 888 |
+
overflow: hidden;
|
| 889 |
+
font-size: 12px;
|
| 890 |
+
padding: 10px;
|
| 891 |
+
height: 53px;
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
/**
|
| 895 |
+
* Addons Tab
|
| 896 |
+
*/
|
| 897 |
+
.as3cf-addons {
|
| 898 |
+
.as3cf-addons-list {
|
| 899 |
+
margin: 20px 0 200px;
|
| 900 |
+
padding-top: 5px;
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
.as3cf-addon {
|
| 904 |
+
display: flex;
|
| 905 |
+
padding: 20px;
|
| 906 |
+
font-size: 14px;
|
| 907 |
+
|
| 908 |
+
&-info {
|
| 909 |
+
min-height: 100px;
|
| 910 |
+
}
|
| 911 |
+
|
| 912 |
+
&-links {
|
| 913 |
+
float: right;
|
| 914 |
+
|
| 915 |
+
span {
|
| 916 |
+
padding: 4px 6px;
|
| 917 |
+
}
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
&-icon {
|
| 921 |
+
float: left;
|
| 922 |
+
margin-right: 20px;
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
&-details {
|
| 926 |
+
white-space: nowrap;
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
&-title,
|
| 930 |
+
&-description {
|
| 931 |
+
font-weight: 100;
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
+ .as3cf-addon {
|
| 935 |
+
margin-top: 20px;
|
| 936 |
+
}
|
| 937 |
+
|
| 938 |
+
&.amazon-s3-and-cloudfront-assets-pull {
|
| 939 |
+
background-color: $as3cf_assets;
|
| 940 |
+
color: white;
|
| 941 |
+
|
| 942 |
+
.as3cf-addon-title,
|
| 943 |
+
.as3cf-addon-description,
|
| 944 |
+
a {
|
| 945 |
+
color: white;
|
| 946 |
+
}
|
| 947 |
+
|
| 948 |
+
.extra {
|
| 949 |
+
background: white;
|
| 950 |
+
a {
|
| 951 |
+
color: $as3cf_assets;
|
| 952 |
+
text-decoration: none;
|
| 953 |
+
}
|
| 954 |
+
}
|
| 955 |
+
}
|
| 956 |
+
}
|
| 957 |
+
}
|
classes/amazon-s3-and-cloudfront.php
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
<?php
|
| 2 |
|
|
|
|
| 3 |
use DeliciousBrains\WP_Offload_S3\Null_S3_Client;
|
|
|
|
| 4 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Content_Replace_URLs;
|
| 5 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_EDD_Replace_URLs;
|
| 6 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_File_Sizes;
|
|
@@ -8,7 +10,7 @@ use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Filter_Post_Excerpt;
|
|
| 8 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Meta_WP_Error;
|
| 9 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Region_Meta;
|
| 10 |
|
| 11 |
-
class Amazon_S3_And_CloudFront extends
|
| 12 |
|
| 13 |
/**
|
| 14 |
* @var Amazon_Web_Services
|
|
@@ -16,10 +18,15 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 16 |
private $aws;
|
| 17 |
|
| 18 |
/**
|
| 19 |
-
* @var
|
| 20 |
*/
|
| 21 |
private $s3client;
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
/**
|
| 24 |
* @var array
|
| 25 |
*/
|
|
@@ -40,21 +47,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 40 |
*/
|
| 41 |
protected static $admin_notices = array();
|
| 42 |
|
| 43 |
-
/**
|
| 44 |
-
* @var
|
| 45 |
-
*/
|
| 46 |
-
protected static $plugin_page;
|
| 47 |
-
|
| 48 |
/**
|
| 49 |
* @var string
|
| 50 |
*/
|
| 51 |
protected $plugin_prefix = 'as3cf';
|
| 52 |
|
| 53 |
-
/**
|
| 54 |
-
* @var string
|
| 55 |
-
*/
|
| 56 |
-
protected $default_tab = '';
|
| 57 |
-
|
| 58 |
/**
|
| 59 |
* @var AS3CF_Local_To_S3
|
| 60 |
*/
|
|
@@ -98,16 +95,20 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 98 |
const LATEST_UPGRADE_ROUTINE = 6;
|
| 99 |
|
| 100 |
/**
|
| 101 |
-
* @param string
|
| 102 |
-
* @param Amazon_Web_Services $aws
|
| 103 |
-
* @param string|null
|
| 104 |
*/
|
| 105 |
-
function __construct( $plugin_file_path, $aws, $slug = null ) {
|
| 106 |
$this->plugin_slug = ( is_null( $slug ) ) ? 'amazon-s3-and-cloudfront' : $slug;
|
| 107 |
|
| 108 |
parent::__construct( $plugin_file_path );
|
| 109 |
|
| 110 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
$this->notices = AS3CF_Notices::get_instance( $this );
|
| 112 |
|
| 113 |
$this->init( $plugin_file_path );
|
|
@@ -119,9 +120,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 119 |
* @param string $plugin_file_path
|
| 120 |
*/
|
| 121 |
function init( $plugin_file_path ) {
|
| 122 |
-
|
| 123 |
-
$this->
|
| 124 |
-
|
|
|
|
|
|
|
| 125 |
|
| 126 |
new Upgrade_Region_Meta( $this );
|
| 127 |
new Upgrade_File_Sizes( $this );
|
|
@@ -131,11 +134,15 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 131 |
new Upgrade_Filter_Post_Excerpt( $this );
|
| 132 |
|
| 133 |
// Plugin setup
|
| 134 |
-
add_action( '
|
|
|
|
|
|
|
| 135 |
add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
| 136 |
-
add_filter( '
|
|
|
|
| 137 |
// display a notice when either lite or pro is automatically deactivated
|
| 138 |
add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
|
|
|
|
| 139 |
|
| 140 |
// Attachment screens/modals
|
| 141 |
add_action( 'load-upload.php', array( $this, 'load_media_assets' ), 11 );
|
|
@@ -150,6 +157,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 150 |
add_action( 'wp_ajax_as3cf-get-url-preview', array( $this, 'ajax_get_url_preview' ) );
|
| 151 |
add_action( 'wp_ajax_as3cf_get_attachment_s3_details', array( $this, 'ajax_get_attachment_s3_details' ) );
|
| 152 |
add_action( 'wp_ajax_as3cf-get-diagnostic-info', array( $this, 'ajax_get_diagnostic_info' ) );
|
|
|
|
|
|
|
| 153 |
|
| 154 |
// Rewriting URLs, doesn't depend on plugin being setup
|
| 155 |
add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
|
|
@@ -184,6 +193,13 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 184 |
$this->register_modal_assets();
|
| 185 |
}
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
/**
|
| 188 |
* Get the plugin title to be used in page headings
|
| 189 |
*
|
|
@@ -252,6 +268,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 252 |
function get_setting( $key, $default = '' ) {
|
| 253 |
// use settings from $_POST when generating URL preview via AJAX
|
| 254 |
if ( isset( $_POST['action'] ) && 'as3cf-get-url-preview' == sanitize_key( $_POST['action'] ) ) { // input var okay
|
|
|
|
| 255 |
$value = 0;
|
| 256 |
if ( isset( $_POST[ $key ] ) ) { // input var okay
|
| 257 |
$value = $_POST[ $key ]; // input var okay
|
|
@@ -752,6 +769,80 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 752 |
$this->end_ajax( $out );
|
| 753 |
}
|
| 754 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 755 |
/**
|
| 756 |
* Delete bulk objects from an S3 bucket
|
| 757 |
*
|
|
@@ -828,7 +919,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 828 |
* to cope with possible different regions
|
| 829 |
*/
|
| 830 |
function delete_attachment( $post_id, $force_new_s3_client = false ) {
|
| 831 |
-
if ( ! $this->is_plugin_setup() ) {
|
| 832 |
return;
|
| 833 |
}
|
| 834 |
|
|
@@ -851,7 +942,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 851 |
* @return array
|
| 852 |
*/
|
| 853 |
function wp_update_attachment_metadata( $data, $post_id ) {
|
| 854 |
-
if ( ! $this->is_plugin_setup() ) {
|
| 855 |
return $data;
|
| 856 |
}
|
| 857 |
|
|
@@ -947,9 +1038,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 947 |
// use existing bucket
|
| 948 |
$bucket = $old_s3object['bucket'];
|
| 949 |
// get existing region
|
| 950 |
-
|
| 951 |
-
$region = $old_s3object['region'];
|
| 952 |
-
};
|
| 953 |
} else {
|
| 954 |
// derive prefix from various settings
|
| 955 |
if ( isset( $data['file'] ) ) {
|
|
@@ -972,19 +1061,6 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 972 |
$acl = apply_filters( 'wps3_upload_acl', $acl, $type, $data, $post_id, $this ); // Old naming convention, will be deprecated soon
|
| 973 |
$acl = apply_filters( 'as3cf_upload_acl', $acl, $data, $post_id );
|
| 974 |
|
| 975 |
-
$s3object = array(
|
| 976 |
-
'bucket' => $bucket,
|
| 977 |
-
'key' => $prefix . $file_name,
|
| 978 |
-
'region' => $region,
|
| 979 |
-
);
|
| 980 |
-
|
| 981 |
-
// store acl if not default
|
| 982 |
-
if ( $acl != self::DEFAULT_ACL ) {
|
| 983 |
-
$s3object['acl'] = $acl;
|
| 984 |
-
}
|
| 985 |
-
|
| 986 |
-
$s3client = $this->get_s3client( $region, $force_new_s3_client );
|
| 987 |
-
|
| 988 |
$args = array(
|
| 989 |
'Bucket' => $bucket,
|
| 990 |
'Key' => $prefix . $file_name,
|
|
@@ -1005,11 +1081,24 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 1005 |
|
| 1006 |
$image_size = wp_attachment_is_image( $post_id ) ? 'full' : '';
|
| 1007 |
$args = apply_filters( 'as3cf_object_meta', $args, $post_id, $image_size, false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1008 |
|
| 1009 |
do_action( 'as3cf_upload_attachment_pre_remove', $post_id, $s3object, $prefix, $args );
|
| 1010 |
|
| 1011 |
$files_to_remove = array();
|
| 1012 |
|
|
|
|
|
|
|
| 1013 |
try {
|
| 1014 |
$s3client->putObject( $args );
|
| 1015 |
$files_to_remove[] = $file_path;
|
|
@@ -1341,7 +1430,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 1341 |
* @return string
|
| 1342 |
*/
|
| 1343 |
public function filter_unique_filename( $filename, $post_id = null ) {
|
| 1344 |
-
if ( ! $this->get_setting( 'copy-to-s3' ) || ! $this->is_plugin_setup() ) {
|
| 1345 |
return $filename;
|
| 1346 |
}
|
| 1347 |
|
|
@@ -1514,10 +1603,12 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 1514 |
/**
|
| 1515 |
* Check the plugin is correctly setup
|
| 1516 |
*
|
|
|
|
|
|
|
| 1517 |
* @return bool
|
| 1518 |
*/
|
| 1519 |
-
function is_plugin_setup() {
|
| 1520 |
-
if ( $this->aws->needs_access_keys() ) {
|
| 1521 |
// AWS not configured
|
| 1522 |
return false;
|
| 1523 |
}
|
|
@@ -1842,7 +1933,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 1842 |
}
|
| 1843 |
}
|
| 1844 |
|
| 1845 |
-
if ( ! is_null( $expires ) && $this->is_plugin_setup() ) {
|
| 1846 |
try {
|
| 1847 |
$expires = time() + apply_filters( 'as3cf_expires', $expires );
|
| 1848 |
$secure_url = $this->get_s3client( $region )
|
|
@@ -2183,7 +2274,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2183 |
* @return string
|
| 2184 |
*/
|
| 2185 |
function update_attached_file( $file, $attachment_id ) {
|
| 2186 |
-
if ( ! $this->is_plugin_setup() ) {
|
| 2187 |
return $file;
|
| 2188 |
}
|
| 2189 |
|
|
@@ -2438,12 +2529,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2438 |
}
|
| 2439 |
|
| 2440 |
/**
|
| 2441 |
-
* Add the settings menu item
|
| 2442 |
-
*
|
| 2443 |
-
* @param Amazon_Web_Services $aws
|
| 2444 |
*/
|
| 2445 |
-
function admin_menu(
|
| 2446 |
-
$hook_suffix =
|
|
|
|
| 2447 |
$this->get_plugin_page_title(),
|
| 2448 |
$this->plugin_menu_title,
|
| 2449 |
'manage_options',
|
|
@@ -2451,10 +2541,24 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2451 |
array( $this, 'render_page' )
|
| 2452 |
);
|
| 2453 |
|
| 2454 |
-
|
| 2455 |
-
|
| 2456 |
-
|
| 2457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2458 |
}
|
| 2459 |
|
| 2460 |
/**
|
|
@@ -2463,10 +2567,13 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2463 |
* @param bool|string $region specify region to client for signature
|
| 2464 |
* @param bool $force force return of new S3 client when swapping regions
|
| 2465 |
*
|
| 2466 |
-
* @return
|
| 2467 |
*/
|
| 2468 |
public function get_s3client( $region = false, $force = false ) {
|
| 2469 |
-
if ( is_null( $this->s3client ) ||
|
|
|
|
|
|
|
|
|
|
| 2470 |
|
| 2471 |
$args = array(
|
| 2472 |
'version' => self::S3_API_VERSION,
|
|
@@ -2477,9 +2584,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2477 |
$args['signature'] = self::AWS_SIGNATURE;
|
| 2478 |
}
|
| 2479 |
|
|
|
|
|
|
|
| 2480 |
try {
|
| 2481 |
$aws_client = $this->aws->get_client();
|
| 2482 |
-
$this->set_client( $aws_client->get( 's3', $args ) );
|
| 2483 |
} catch ( \Exception $e ) {
|
| 2484 |
AS3CF_Error::log( $e->getMessage() );
|
| 2485 |
$this->set_client( new Null_S3_Client );
|
|
@@ -2493,9 +2602,14 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2493 |
* Setter for S3 client
|
| 2494 |
*
|
| 2495 |
* @param Aws\S3\S3Client|Null_S3_Client $client
|
|
|
|
| 2496 |
*/
|
| 2497 |
-
public function set_client( $client ) {
|
| 2498 |
$this->s3client = $client;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2499 |
}
|
| 2500 |
|
| 2501 |
/**
|
|
@@ -2633,6 +2747,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2633 |
* @return bool|WP_Error
|
| 2634 |
*/
|
| 2635 |
function check_write_permission( $bucket = null, $region = null ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2636 |
if ( is_null( $bucket ) ) {
|
| 2637 |
if ( ! ( $bucket = $this->get_setting( 'bucket' ) ) ) {
|
| 2638 |
// if no bucket set then no need check
|
|
@@ -2720,8 +2839,20 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2720 |
* On plugin load.
|
| 2721 |
*/
|
| 2722 |
public function plugin_load() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2723 |
$this->enqueue_style( 'as3cf-styles', 'assets/css/styles', array( 'as3cf-modal' ) );
|
| 2724 |
-
$this->enqueue_script( 'as3cf-script', 'assets/js/script', array( 'jquery', 'as3cf-modal' ) );
|
| 2725 |
|
| 2726 |
wp_localize_script( 'as3cf-script',
|
| 2727 |
'as3cf',
|
|
@@ -2737,6 +2868,9 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2737 |
'save_alert' => __( 'The changes you made will be lost if you navigate away from this page', 'amazon-s3-and-cloudfront' ),
|
| 2738 |
'get_diagnostic_info' => __( 'Getting diagnostic info...', 'amazon-s3-and-cloudfront' ),
|
| 2739 |
'get_diagnostic_info_error' => __( 'Error getting diagnostic info: ', 'amazon-s3-and-cloudfront' ),
|
|
|
|
|
|
|
|
|
|
| 2740 |
),
|
| 2741 |
'nonces' => array(
|
| 2742 |
'create_bucket' => wp_create_nonce( 'as3cf-create-bucket' ),
|
|
@@ -2745,6 +2879,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2745 |
'save_bucket' => wp_create_nonce( 'as3cf-save-bucket' ),
|
| 2746 |
'get_url_preview' => wp_create_nonce( 'as3cf-get-url-preview' ),
|
| 2747 |
'get_diagnostic_info' => wp_create_nonce( 'as3cf-get-diagnostic-info' ),
|
|
|
|
|
|
|
| 2748 |
),
|
| 2749 |
'is_pro' => $this->is_pro(),
|
| 2750 |
'aws_bucket_link' => $this->get_aws_bucket_link(),
|
|
@@ -2810,7 +2946,6 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2810 |
do_action( 'as3cf_pre_save_settings' );
|
| 2811 |
|
| 2812 |
$post_vars = $this->get_settings_whitelist();
|
| 2813 |
-
$skip_sanitize = $this->get_skip_sanitize_settings();
|
| 2814 |
|
| 2815 |
foreach ( $post_vars as $var ) {
|
| 2816 |
$this->remove_setting( $var );
|
|
@@ -2819,11 +2954,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2819 |
continue;
|
| 2820 |
}
|
| 2821 |
|
| 2822 |
-
|
| 2823 |
-
$value = wp_strip_all_tags( $_POST[ $var ] ); // input var okay
|
| 2824 |
-
} else {
|
| 2825 |
-
$value = sanitize_text_field( $_POST[ $var ] ); // input var okay
|
| 2826 |
-
}
|
| 2827 |
|
| 2828 |
$this->set_setting( $var, $value );
|
| 2829 |
}
|
|
@@ -2835,72 +2966,20 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2835 |
exit;
|
| 2836 |
}
|
| 2837 |
|
| 2838 |
-
/**
|
| 2839 |
-
* Helper method to return the settings page URL for the plugin
|
| 2840 |
-
*
|
| 2841 |
-
* @param array $args
|
| 2842 |
-
* @param string $url_method To prepend to admin_url()
|
| 2843 |
-
* @param bool $escape Should we escape the URL
|
| 2844 |
-
*
|
| 2845 |
-
* @return string
|
| 2846 |
-
*/
|
| 2847 |
-
function get_plugin_page_url( $args = array(), $url_method = 'network', $escape = true ) {
|
| 2848 |
-
$default_args = array(
|
| 2849 |
-
'page' => self::$plugin_page,
|
| 2850 |
-
);
|
| 2851 |
-
|
| 2852 |
-
$args = array_merge( $default_args, $args );
|
| 2853 |
-
|
| 2854 |
-
switch ( $url_method ) {
|
| 2855 |
-
case 'self':
|
| 2856 |
-
$base_url = self_admin_url( 'admin.php' );
|
| 2857 |
-
break;
|
| 2858 |
-
case '':
|
| 2859 |
-
$base_url = admin_url( 'admin.php' );
|
| 2860 |
-
break;
|
| 2861 |
-
default:
|
| 2862 |
-
$base_url = network_admin_url( 'admin.php' );
|
| 2863 |
-
}
|
| 2864 |
-
|
| 2865 |
-
// Add a hash to the URL
|
| 2866 |
-
$hash = false;
|
| 2867 |
-
if ( isset( $args['hash'] ) ) {
|
| 2868 |
-
$hash = $args['hash'];
|
| 2869 |
-
unset( $args['hash'] );
|
| 2870 |
-
} else if ( $this->default_tab ) {
|
| 2871 |
-
$hash = $this->default_tab;
|
| 2872 |
-
}
|
| 2873 |
-
|
| 2874 |
-
$url = add_query_arg( $args, $base_url );
|
| 2875 |
-
|
| 2876 |
-
if ( $hash ) {
|
| 2877 |
-
$url .= '#' . $hash;
|
| 2878 |
-
}
|
| 2879 |
-
|
| 2880 |
-
if ( $escape ) {
|
| 2881 |
-
$url = esc_url_raw( $url );
|
| 2882 |
-
}
|
| 2883 |
-
|
| 2884 |
-
return $url;
|
| 2885 |
-
}
|
| 2886 |
-
|
| 2887 |
/**
|
| 2888 |
* Display the main settings page for the plugin
|
| 2889 |
*/
|
| 2890 |
function render_page() {
|
| 2891 |
-
$this->
|
|
|
|
| 2892 |
|
| 2893 |
-
|
| 2894 |
-
|
| 2895 |
-
|
| 2896 |
-
|
| 2897 |
-
|
| 2898 |
-
do_action( 'as3cf_post_settings_render' );
|
| 2899 |
-
} catch ( \Exception $e ) {
|
| 2900 |
-
$this->render_view( 'error-fatal', array( 'message' => $e->getMessage() ) );
|
| 2901 |
-
}
|
| 2902 |
|
| 2903 |
-
$this->
|
| 2904 |
}
|
| 2905 |
|
| 2906 |
/**
|
|
@@ -2910,13 +2989,33 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 2910 |
*/
|
| 2911 |
function get_settings_tabs() {
|
| 2912 |
$tabs = array(
|
| 2913 |
-
'media'
|
| 2914 |
-
'
|
|
|
|
|
|
|
| 2915 |
);
|
| 2916 |
|
| 2917 |
return apply_filters( 'as3cf_settings_tabs', $tabs );
|
| 2918 |
}
|
| 2919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2920 |
/**
|
| 2921 |
* Get the prefix path for the files. Ignores WP media library
|
| 2922 |
* year month subdirectory setting and just uses S3 setting
|
|
@@ -3137,7 +3236,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 3137 |
* Check if PHP GD and Imagick is installed
|
| 3138 |
*/
|
| 3139 |
function check_for_gd_imagick() {
|
| 3140 |
-
if ( ! $this->is_plugin_setup() ) {
|
| 3141 |
// No notice until plugin is setup
|
| 3142 |
return;
|
| 3143 |
}
|
|
@@ -3339,7 +3438,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 3339 |
|
| 3340 |
$output .= 'cURL: ';
|
| 3341 |
if ( function_exists( 'curl_init' ) ) {
|
| 3342 |
-
$
|
|
|
|
| 3343 |
} else {
|
| 3344 |
$output .= 'Disabled';
|
| 3345 |
}
|
|
@@ -3492,10 +3592,21 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 3492 |
}
|
| 3493 |
|
| 3494 |
$theme_info = wp_get_theme();
|
| 3495 |
-
$output .= "Active Theme Name: " . esc_html( $theme_info->get( 'Name' ) )
|
| 3496 |
-
$output .= "
|
| 3497 |
-
|
| 3498 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3499 |
}
|
| 3500 |
if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
|
| 3501 |
$output .= "WARNING: Active Theme Folder Not Found\r\n";
|
|
@@ -3748,6 +3859,10 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 3748 |
* @return string
|
| 3749 |
*/
|
| 3750 |
function get_access_denied_notice_message( $single = true ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3751 |
$url = $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array(
|
| 3752 |
'utm_campaign' => 'error+messages',
|
| 3753 |
), 'bucket-restrictions' );
|
|
@@ -3770,7 +3885,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 3770 |
*
|
| 3771 |
* @return float|int
|
| 3772 |
*/
|
| 3773 |
-
function
|
| 3774 |
global $wpdb;
|
| 3775 |
|
| 3776 |
// Sum the total file size (including image sizes) for all S3 attachments
|
|
@@ -3962,10 +4077,10 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 3962 |
}
|
| 3963 |
|
| 3964 |
$url = $this->dbrains_url( $path, $args, $hash );
|
| 3965 |
-
$text = __( 'More info', 'amazon-s3-and-cloudfront' );
|
| 3966 |
$link = AS3CF_Utils::dbrains_link( $url, $text );
|
| 3967 |
|
| 3968 |
-
return sprintf( '<span class="more-info">%s
|
| 3969 |
}
|
| 3970 |
|
| 3971 |
/**
|
|
@@ -4404,4 +4519,119 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
|
|
| 4404 |
|
| 4405 |
return $errors;
|
| 4406 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4407 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
|
| 4 |
use DeliciousBrains\WP_Offload_S3\Null_S3_Client;
|
| 5 |
+
use DeliciousBrains\WP_Offload_S3\Amazon_Web_Services;
|
| 6 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Content_Replace_URLs;
|
| 7 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_EDD_Replace_URLs;
|
| 8 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_File_Sizes;
|
| 10 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Meta_WP_Error;
|
| 11 |
use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Region_Meta;
|
| 12 |
|
| 13 |
+
class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
|
| 14 |
|
| 15 |
/**
|
| 16 |
* @var Amazon_Web_Services
|
| 18 |
private $aws;
|
| 19 |
|
| 20 |
/**
|
| 21 |
+
* @var S3Client
|
| 22 |
*/
|
| 23 |
private $s3client;
|
| 24 |
|
| 25 |
+
/**
|
| 26 |
+
* @var string
|
| 27 |
+
*/
|
| 28 |
+
private $s3client_region;
|
| 29 |
+
|
| 30 |
/**
|
| 31 |
* @var array
|
| 32 |
*/
|
| 47 |
*/
|
| 48 |
protected static $admin_notices = array();
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
/**
|
| 51 |
* @var string
|
| 52 |
*/
|
| 53 |
protected $plugin_prefix = 'as3cf';
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
/**
|
| 56 |
* @var AS3CF_Local_To_S3
|
| 57 |
*/
|
| 95 |
const LATEST_UPGRADE_ROUTINE = 6;
|
| 96 |
|
| 97 |
/**
|
| 98 |
+
* @param string $plugin_file_path
|
| 99 |
+
* @param Amazon_Web_Services|null $aws
|
| 100 |
+
* @param string|null $slug
|
| 101 |
*/
|
| 102 |
+
function __construct( $plugin_file_path, $aws = null, $slug = null ) {
|
| 103 |
$this->plugin_slug = ( is_null( $slug ) ) ? 'amazon-s3-and-cloudfront' : $slug;
|
| 104 |
|
| 105 |
parent::__construct( $plugin_file_path );
|
| 106 |
|
| 107 |
+
if ( is_null( $aws ) ) {
|
| 108 |
+
$this->aws = new \DeliciousBrains\WP_Offload_S3\Amazon_Web_Services( $plugin_file_path );
|
| 109 |
+
} else {
|
| 110 |
+
$this->aws = $aws;
|
| 111 |
+
}
|
| 112 |
$this->notices = AS3CF_Notices::get_instance( $this );
|
| 113 |
|
| 114 |
$this->init( $plugin_file_path );
|
| 120 |
* @param string $plugin_file_path
|
| 121 |
*/
|
| 122 |
function init( $plugin_file_path ) {
|
| 123 |
+
$this->plugin_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
|
| 124 |
+
$this->plugin_menu_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
|
| 125 |
+
|
| 126 |
+
// Bundled SDK may require AWS setup before data migrations.
|
| 127 |
+
$this->handle_aws_access_key_migration();
|
| 128 |
|
| 129 |
new Upgrade_Region_Meta( $this );
|
| 130 |
new Upgrade_File_Sizes( $this );
|
| 134 |
new Upgrade_Filter_Post_Excerpt( $this );
|
| 135 |
|
| 136 |
// Plugin setup
|
| 137 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
| 138 |
+
add_action( 'network_admin_menu', array( $this, 'admin_menu' ) );
|
| 139 |
+
add_action( 'aws_admin_menu', array( $this, 'aws_admin_menu' ) );
|
| 140 |
add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
| 141 |
+
add_filter( 'network_admin_plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
| 142 |
+
add_filter( 'pre_get_space_used', array( $this, 'multisite_get_space_used' ) );
|
| 143 |
// display a notice when either lite or pro is automatically deactivated
|
| 144 |
add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
|
| 145 |
+
add_action( 'as3cf_plugin_load', array( $this, 'remove_aws_keys_if_constants_set' ) );
|
| 146 |
|
| 147 |
// Attachment screens/modals
|
| 148 |
add_action( 'load-upload.php', array( $this, 'load_media_assets' ), 11 );
|
| 157 |
add_action( 'wp_ajax_as3cf-get-url-preview', array( $this, 'ajax_get_url_preview' ) );
|
| 158 |
add_action( 'wp_ajax_as3cf_get_attachment_s3_details', array( $this, 'ajax_get_attachment_s3_details' ) );
|
| 159 |
add_action( 'wp_ajax_as3cf-get-diagnostic-info', array( $this, 'ajax_get_diagnostic_info' ) );
|
| 160 |
+
add_action( 'wp_ajax_as3cf-aws-keys-set', array( $this, 'ajax_set_aws_keys' ) );
|
| 161 |
+
add_action( 'wp_ajax_as3cf-aws-keys-remove', array( $this, 'ajax_remove_aws_keys' ) );
|
| 162 |
|
| 163 |
// Rewriting URLs, doesn't depend on plugin being setup
|
| 164 |
add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
|
| 193 |
$this->register_modal_assets();
|
| 194 |
}
|
| 195 |
|
| 196 |
+
/**
|
| 197 |
+
* @return Amazon_Web_Services
|
| 198 |
+
*/
|
| 199 |
+
public function get_aws() {
|
| 200 |
+
return $this->aws;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
/**
|
| 204 |
* Get the plugin title to be used in page headings
|
| 205 |
*
|
| 268 |
function get_setting( $key, $default = '' ) {
|
| 269 |
// use settings from $_POST when generating URL preview via AJAX
|
| 270 |
if ( isset( $_POST['action'] ) && 'as3cf-get-url-preview' == sanitize_key( $_POST['action'] ) ) { // input var okay
|
| 271 |
+
$this->verify_ajax_request();
|
| 272 |
$value = 0;
|
| 273 |
if ( isset( $_POST[ $key ] ) ) { // input var okay
|
| 274 |
$value = $_POST[ $key ]; // input var okay
|
| 769 |
$this->end_ajax( $out );
|
| 770 |
}
|
| 771 |
|
| 772 |
+
/**
|
| 773 |
+
* Set AWS keys via ajax.
|
| 774 |
+
*/
|
| 775 |
+
public function ajax_set_aws_keys() {
|
| 776 |
+
check_ajax_referer( 'as3cf-aws-keys-set' );
|
| 777 |
+
|
| 778 |
+
$key_id = filter_input( INPUT_POST, 'aws-access-key-id' );
|
| 779 |
+
$secret_key = filter_input( INPUT_POST, 'aws-secret-access-key' );
|
| 780 |
+
$response = array(
|
| 781 |
+
'message' => __( 'Access keys updated successfully.', 'amazon-s3-and-cloudfront' ),
|
| 782 |
+
);
|
| 783 |
+
|
| 784 |
+
if ( Amazon_Web_Services::is_any_access_key_constant_defined() ) {
|
| 785 |
+
wp_send_json_error( array(
|
| 786 |
+
'message' => __( 'All access key constants must be removed before keys can be set in the database.', 'amazon-s3-and-cloudfront' ),
|
| 787 |
+
) );
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
if ( $key_id ) {
|
| 791 |
+
$this->set_setting( 'aws-access-key-id', $key_id );
|
| 792 |
+
} else {
|
| 793 |
+
wp_send_json_error( array(
|
| 794 |
+
'message' => __( 'The Access Key ID must be set.', 'amazon-s3-and-cloudfront' ),
|
| 795 |
+
) );
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
// Only update the secret key if entered and not set to "-- not shown --".
|
| 799 |
+
if ( _x( '-- not shown --', 'placeholder for hidden access key, 39 char max', 'amazon-s3-and-cloudfront' ) !== $secret_key || ! $this->get_setting( 'aws-secret-access-key' ) ) {
|
| 800 |
+
// AWS Secret Access keys are 40 char long.
|
| 801 |
+
if ( ! $secret_key || strlen( $secret_key ) < 40 ) {
|
| 802 |
+
wp_send_json_error( array(
|
| 803 |
+
'message' => __( 'The Secret Access Key must be at least 40 characters long.', 'amazon-s3-and-cloudfront' ),
|
| 804 |
+
) );
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
$this->set_setting( 'aws-secret-access-key', $secret_key );
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
$this->save_settings();
|
| 811 |
+
|
| 812 |
+
wp_send_json_success( $response );
|
| 813 |
+
}
|
| 814 |
+
|
| 815 |
+
/**
|
| 816 |
+
* Remove AWS access keys via ajax.
|
| 817 |
+
*/
|
| 818 |
+
public function ajax_remove_aws_keys() {
|
| 819 |
+
check_ajax_referer( 'as3cf-aws-keys-remove' );
|
| 820 |
+
|
| 821 |
+
$this->remove_aws_keys();
|
| 822 |
+
|
| 823 |
+
wp_send_json_success( array(
|
| 824 |
+
'message' => __( 'Access keys removed from the database successfully.', 'amazon-s3-and-cloudfront' ),
|
| 825 |
+
) );
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
/**
|
| 829 |
+
* Remove AWS access keys from saved settings if a key constant is defined.
|
| 830 |
+
*/
|
| 831 |
+
public function remove_aws_keys_if_constants_set() {
|
| 832 |
+
if ( Amazon_Web_Services::is_any_access_key_constant_defined() ) {
|
| 833 |
+
$this->remove_aws_keys();
|
| 834 |
+
}
|
| 835 |
+
}
|
| 836 |
+
|
| 837 |
+
/**
|
| 838 |
+
* Remove AWS keys from settings.
|
| 839 |
+
*/
|
| 840 |
+
protected function remove_aws_keys() {
|
| 841 |
+
$this->remove_setting( 'aws-access-key-id' );
|
| 842 |
+
$this->remove_setting( 'aws-secret-access-key' );
|
| 843 |
+
$this->save_settings();
|
| 844 |
+
}
|
| 845 |
+
|
| 846 |
/**
|
| 847 |
* Delete bulk objects from an S3 bucket
|
| 848 |
*
|
| 919 |
* to cope with possible different regions
|
| 920 |
*/
|
| 921 |
function delete_attachment( $post_id, $force_new_s3_client = false ) {
|
| 922 |
+
if ( ! $this->is_plugin_setup( true ) ) {
|
| 923 |
return;
|
| 924 |
}
|
| 925 |
|
| 942 |
* @return array
|
| 943 |
*/
|
| 944 |
function wp_update_attachment_metadata( $data, $post_id ) {
|
| 945 |
+
if ( ! $this->is_plugin_setup( true ) ) {
|
| 946 |
return $data;
|
| 947 |
}
|
| 948 |
|
| 1038 |
// use existing bucket
|
| 1039 |
$bucket = $old_s3object['bucket'];
|
| 1040 |
// get existing region
|
| 1041 |
+
$region = isset( $old_s3object['region'] ) ? $old_s3object['region'] : '';
|
|
|
|
|
|
|
| 1042 |
} else {
|
| 1043 |
// derive prefix from various settings
|
| 1044 |
if ( isset( $data['file'] ) ) {
|
| 1061 |
$acl = apply_filters( 'wps3_upload_acl', $acl, $type, $data, $post_id, $this ); // Old naming convention, will be deprecated soon
|
| 1062 |
$acl = apply_filters( 'as3cf_upload_acl', $acl, $data, $post_id );
|
| 1063 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1064 |
$args = array(
|
| 1065 |
'Bucket' => $bucket,
|
| 1066 |
'Key' => $prefix . $file_name,
|
| 1081 |
|
| 1082 |
$image_size = wp_attachment_is_image( $post_id ) ? 'full' : '';
|
| 1083 |
$args = apply_filters( 'as3cf_object_meta', $args, $post_id, $image_size, false );
|
| 1084 |
+
$s3object = array(
|
| 1085 |
+
'region' => $bucket !== $args['Bucket'] ? $this->get_bucket_region( $args['Bucket'], true ) : $region,
|
| 1086 |
+
'bucket' => $args['Bucket'],
|
| 1087 |
+
'key' => $args['Key'],
|
| 1088 |
+
'acl' => $args['ACL'],
|
| 1089 |
+
);
|
| 1090 |
+
|
| 1091 |
+
// Do not store object ACL if set to the default value.
|
| 1092 |
+
if ( $s3object['acl'] === self::DEFAULT_ACL ) {
|
| 1093 |
+
unset( $s3object['acl'] );
|
| 1094 |
+
}
|
| 1095 |
|
| 1096 |
do_action( 'as3cf_upload_attachment_pre_remove', $post_id, $s3object, $prefix, $args );
|
| 1097 |
|
| 1098 |
$files_to_remove = array();
|
| 1099 |
|
| 1100 |
+
$s3client = $this->get_s3client( $s3object['region'], $force_new_s3_client );
|
| 1101 |
+
|
| 1102 |
try {
|
| 1103 |
$s3client->putObject( $args );
|
| 1104 |
$files_to_remove[] = $file_path;
|
| 1430 |
* @return string
|
| 1431 |
*/
|
| 1432 |
public function filter_unique_filename( $filename, $post_id = null ) {
|
| 1433 |
+
if ( ! $this->get_setting( 'copy-to-s3' ) || ! $this->is_plugin_setup( true ) ) {
|
| 1434 |
return $filename;
|
| 1435 |
}
|
| 1436 |
|
| 1603 |
/**
|
| 1604 |
* Check the plugin is correctly setup
|
| 1605 |
*
|
| 1606 |
+
* @param bool $with_credentials Do S3 credentials need to be set up too? Defaults to false.
|
| 1607 |
+
*
|
| 1608 |
* @return bool
|
| 1609 |
*/
|
| 1610 |
+
function is_plugin_setup( $with_credentials = false ) {
|
| 1611 |
+
if ( $with_credentials && $this->aws->needs_access_keys() ) {
|
| 1612 |
// AWS not configured
|
| 1613 |
return false;
|
| 1614 |
}
|
| 1933 |
}
|
| 1934 |
}
|
| 1935 |
|
| 1936 |
+
if ( ! is_null( $expires ) && $this->is_plugin_setup( true ) ) {
|
| 1937 |
try {
|
| 1938 |
$expires = time() + apply_filters( 'as3cf_expires', $expires );
|
| 1939 |
$secure_url = $this->get_s3client( $region )
|
| 2274 |
* @return string
|
| 2275 |
*/
|
| 2276 |
function update_attached_file( $file, $attachment_id ) {
|
| 2277 |
+
if ( ! $this->is_plugin_setup( true ) ) {
|
| 2278 |
return $file;
|
| 2279 |
}
|
| 2280 |
|
| 2529 |
}
|
| 2530 |
|
| 2531 |
/**
|
| 2532 |
+
* Add the settings page to the top-level Settings menu item.
|
|
|
|
|
|
|
| 2533 |
*/
|
| 2534 |
+
public function admin_menu() {
|
| 2535 |
+
$this->hook_suffix = add_submenu_page(
|
| 2536 |
+
$this->get_plugin_pagenow(),
|
| 2537 |
$this->get_plugin_page_title(),
|
| 2538 |
$this->plugin_menu_title,
|
| 2539 |
'manage_options',
|
| 2541 |
array( $this, 'render_page' )
|
| 2542 |
);
|
| 2543 |
|
| 2544 |
+
do_action( 'as3cf_hook_suffix', $this->hook_suffix );
|
| 2545 |
+
|
| 2546 |
+
add_action( 'load-' . $this->hook_suffix, array( $this, 'plugin_load' ) );
|
| 2547 |
+
}
|
| 2548 |
+
|
| 2549 |
+
/**
|
| 2550 |
+
* Add the settings page to the top-level AWS menu item for backwards compatibility.
|
| 2551 |
+
*
|
| 2552 |
+
* @param \Amazon_Web_Services $aws Plugin class instance from the amazon-web-services plugin.
|
| 2553 |
+
*/
|
| 2554 |
+
public function aws_admin_menu( $aws ) {
|
| 2555 |
+
$aws->add_page(
|
| 2556 |
+
$this->get_plugin_page_title(),
|
| 2557 |
+
$this->plugin_menu_title,
|
| 2558 |
+
'manage_options',
|
| 2559 |
+
$this->plugin_slug,
|
| 2560 |
+
array( $this, 'render_page' )
|
| 2561 |
+
);
|
| 2562 |
}
|
| 2563 |
|
| 2564 |
/**
|
| 2567 |
* @param bool|string $region specify region to client for signature
|
| 2568 |
* @param bool $force force return of new S3 client when swapping regions
|
| 2569 |
*
|
| 2570 |
+
* @return S3Client
|
| 2571 |
*/
|
| 2572 |
public function get_s3client( $region = false, $force = false ) {
|
| 2573 |
+
if ( is_null( $this->s3client ) ||
|
| 2574 |
+
is_null( $this->s3client_region ) ||
|
| 2575 |
+
$force ||
|
| 2576 |
+
( false !== $region && $this->s3client_region !== $region ) ) {
|
| 2577 |
|
| 2578 |
$args = array(
|
| 2579 |
'version' => self::S3_API_VERSION,
|
| 2584 |
$args['signature'] = self::AWS_SIGNATURE;
|
| 2585 |
}
|
| 2586 |
|
| 2587 |
+
$s3client_region = isset( $args['region'] ) ? $args['region'] : $region;
|
| 2588 |
+
|
| 2589 |
try {
|
| 2590 |
$aws_client = $this->aws->get_client();
|
| 2591 |
+
$this->set_client( $aws_client->get( 's3', $args ), $s3client_region );
|
| 2592 |
} catch ( \Exception $e ) {
|
| 2593 |
AS3CF_Error::log( $e->getMessage() );
|
| 2594 |
$this->set_client( new Null_S3_Client );
|
| 2602 |
* Setter for S3 client
|
| 2603 |
*
|
| 2604 |
* @param Aws\S3\S3Client|Null_S3_Client $client
|
| 2605 |
+
* @param bool|string $region
|
| 2606 |
*/
|
| 2607 |
+
public function set_client( $client, $region = false ) {
|
| 2608 |
$this->s3client = $client;
|
| 2609 |
+
|
| 2610 |
+
if ( false !== $region ) {
|
| 2611 |
+
$this->s3client_region = $region;
|
| 2612 |
+
}
|
| 2613 |
}
|
| 2614 |
|
| 2615 |
/**
|
| 2747 |
* @return bool|WP_Error
|
| 2748 |
*/
|
| 2749 |
function check_write_permission( $bucket = null, $region = null ) {
|
| 2750 |
+
if ( $this->aws->needs_access_keys() ) {
|
| 2751 |
+
// If no access keys set then no need check.
|
| 2752 |
+
return false;
|
| 2753 |
+
}
|
| 2754 |
+
|
| 2755 |
if ( is_null( $bucket ) ) {
|
| 2756 |
if ( ! ( $bucket = $this->get_setting( 'bucket' ) ) ) {
|
| 2757 |
// if no bucket set then no need check
|
| 2839 |
* On plugin load.
|
| 2840 |
*/
|
| 2841 |
public function plugin_load() {
|
| 2842 |
+
/*
|
| 2843 |
+
* If the request is using the old parent page for the settings page, (i.e. in AWS menu)
|
| 2844 |
+
* redirect to the new one. Unfortunately, there is no way to preserve the hash, if present.
|
| 2845 |
+
* This works because the hook suffix is the same for both, regardless of parent page.
|
| 2846 |
+
*/
|
| 2847 |
+
if ( $this->get_plugin_pagenow() !== $GLOBALS['pagenow'] ) {
|
| 2848 |
+
wp_redirect( $this->get_plugin_page_url() );
|
| 2849 |
+
exit;
|
| 2850 |
+
}
|
| 2851 |
+
|
| 2852 |
+
add_action( 'network_admin_notices', array( $this, 'settings_saved_notice' ) );
|
| 2853 |
+
|
| 2854 |
$this->enqueue_style( 'as3cf-styles', 'assets/css/styles', array( 'as3cf-modal' ) );
|
| 2855 |
+
$this->enqueue_script( 'as3cf-script', 'assets/js/script', array( 'jquery', 'underscore', 'as3cf-modal' ) );
|
| 2856 |
|
| 2857 |
wp_localize_script( 'as3cf-script',
|
| 2858 |
'as3cf',
|
| 2868 |
'save_alert' => __( 'The changes you made will be lost if you navigate away from this page', 'amazon-s3-and-cloudfront' ),
|
| 2869 |
'get_diagnostic_info' => __( 'Getting diagnostic info...', 'amazon-s3-and-cloudfront' ),
|
| 2870 |
'get_diagnostic_info_error' => __( 'Error getting diagnostic info: ', 'amazon-s3-and-cloudfront' ),
|
| 2871 |
+
'not_shown_placeholder' => _x( '-- not shown --', 'placeholder for hidden access key, 39 char max', 'amazon-s3-and-cloudfront' ),
|
| 2872 |
+
// Mimic WP Core's notice text, therefore no translation needed here.
|
| 2873 |
+
'settings_saved' => __( 'Settings saved.' ),
|
| 2874 |
),
|
| 2875 |
'nonces' => array(
|
| 2876 |
'create_bucket' => wp_create_nonce( 'as3cf-create-bucket' ),
|
| 2879 |
'save_bucket' => wp_create_nonce( 'as3cf-save-bucket' ),
|
| 2880 |
'get_url_preview' => wp_create_nonce( 'as3cf-get-url-preview' ),
|
| 2881 |
'get_diagnostic_info' => wp_create_nonce( 'as3cf-get-diagnostic-info' ),
|
| 2882 |
+
'aws_keys_set' => wp_create_nonce( 'as3cf-aws-keys-set' ),
|
| 2883 |
+
'aws_keys_remove' => wp_create_nonce( 'as3cf-aws-keys-remove' ),
|
| 2884 |
),
|
| 2885 |
'is_pro' => $this->is_pro(),
|
| 2886 |
'aws_bucket_link' => $this->get_aws_bucket_link(),
|
| 2946 |
do_action( 'as3cf_pre_save_settings' );
|
| 2947 |
|
| 2948 |
$post_vars = $this->get_settings_whitelist();
|
|
|
|
| 2949 |
|
| 2950 |
foreach ( $post_vars as $var ) {
|
| 2951 |
$this->remove_setting( $var );
|
| 2954 |
continue;
|
| 2955 |
}
|
| 2956 |
|
| 2957 |
+
$value = $this->sanitize_setting( $var, $_POST[ $var ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2958 |
|
| 2959 |
$this->set_setting( $var, $value );
|
| 2960 |
}
|
| 2966 |
exit;
|
| 2967 |
}
|
| 2968 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2969 |
/**
|
| 2970 |
* Display the main settings page for the plugin
|
| 2971 |
*/
|
| 2972 |
function render_page() {
|
| 2973 |
+
$this->render_view( 'header', array( 'page_title' => $this->get_plugin_page_title(), 'page' => 'as3cf' ) );
|
| 2974 |
+
$this->render_view( 'settings-tabs' );
|
| 2975 |
|
| 2976 |
+
do_action( 'as3cf_pre_settings_render' );
|
| 2977 |
+
|
| 2978 |
+
$this->render_view( 'settings' );
|
| 2979 |
+
|
| 2980 |
+
do_action( 'as3cf_post_settings_render' );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2981 |
|
| 2982 |
+
$this->render_view( 'footer' );
|
| 2983 |
}
|
| 2984 |
|
| 2985 |
/**
|
| 2989 |
*/
|
| 2990 |
function get_settings_tabs() {
|
| 2991 |
$tabs = array(
|
| 2992 |
+
'media' => _x( 'Media Library', 'Show the media library tab', 'amazon-s3-and-cloudfront' ),
|
| 2993 |
+
'addons' => _x( 'Addons', 'Show the addons tab', 'amazon-s3-and-cloudfront' ),
|
| 2994 |
+
'settings' => _x( 'Settings', 'Show the settings tab', 'amazon-s3-and-cloudfront' ),
|
| 2995 |
+
'support' => _x( 'Support', 'Show the support tab', 'amazon-s3-and-cloudfront' ),
|
| 2996 |
);
|
| 2997 |
|
| 2998 |
return apply_filters( 'as3cf_settings_tabs', $tabs );
|
| 2999 |
}
|
| 3000 |
|
| 3001 |
+
/**
|
| 3002 |
+
* Recursively build addons list
|
| 3003 |
+
*
|
| 3004 |
+
* @param array|null $addons
|
| 3005 |
+
*/
|
| 3006 |
+
function render_addons( $addons = null ) {
|
| 3007 |
+
if ( is_null( $addons ) ) {
|
| 3008 |
+
$addons = $this->get_addons();
|
| 3009 |
+
}
|
| 3010 |
+
|
| 3011 |
+
foreach ( $addons as $slug => $addon ) {
|
| 3012 |
+
$this->render_view( 'addon', array(
|
| 3013 |
+
'slug' => $slug,
|
| 3014 |
+
'addon' => $addon
|
| 3015 |
+
) );
|
| 3016 |
+
}
|
| 3017 |
+
}
|
| 3018 |
+
|
| 3019 |
/**
|
| 3020 |
* Get the prefix path for the files. Ignores WP media library
|
| 3021 |
* year month subdirectory setting and just uses S3 setting
|
| 3236 |
* Check if PHP GD and Imagick is installed
|
| 3237 |
*/
|
| 3238 |
function check_for_gd_imagick() {
|
| 3239 |
+
if ( ! $this->is_plugin_setup( true ) ) {
|
| 3240 |
// No notice until plugin is setup
|
| 3241 |
return;
|
| 3242 |
}
|
| 3438 |
|
| 3439 |
$output .= 'cURL: ';
|
| 3440 |
if ( function_exists( 'curl_init' ) ) {
|
| 3441 |
+
$curl = curl_version();
|
| 3442 |
+
$output .= esc_html( $curl['version'] );
|
| 3443 |
} else {
|
| 3444 |
$output .= 'Disabled';
|
| 3445 |
}
|
| 3592 |
}
|
| 3593 |
|
| 3594 |
$theme_info = wp_get_theme();
|
| 3595 |
+
$output .= "Active Theme Name: " . esc_html( $theme_info->get( 'Name' ) );
|
| 3596 |
+
$output .= "\r\n";
|
| 3597 |
+
$output .= "Active Theme Version: " . esc_html( $theme_info->get( 'Version' ) );
|
| 3598 |
+
$output .= "\r\n";
|
| 3599 |
+
$output .= "Active Theme Folder: " . esc_html( $theme_info->get_stylesheet() );
|
| 3600 |
+
$output .= "\r\n";
|
| 3601 |
+
|
| 3602 |
+
if ( is_child_theme() ) {
|
| 3603 |
+
$parent_info = $theme_info->parent();
|
| 3604 |
+
$output .= "Parent Theme Name: " . esc_html( $parent_info->get( 'Name' ) );
|
| 3605 |
+
$output .= "\r\n";
|
| 3606 |
+
$output .= "Parent Theme Version: " . esc_html( $parent_info->get( 'Version' ) );
|
| 3607 |
+
$output .= "\r\n";
|
| 3608 |
+
$output .= "Parent Theme Folder: " . esc_html( $parent_info->get_stylesheet() );
|
| 3609 |
+
$output .= "\r\n";
|
| 3610 |
}
|
| 3611 |
if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
|
| 3612 |
$output .= "WARNING: Active Theme Folder Not Found\r\n";
|
| 3859 |
* @return string
|
| 3860 |
*/
|
| 3861 |
function get_access_denied_notice_message( $single = true ) {
|
| 3862 |
+
if ( $this->aws->needs_access_keys() ) {
|
| 3863 |
+
return sprintf( __( '<a href="%s">Define your AWS keys</a> to enable write access to the bucket', 'amazon-s3-and-cloudfront' ), '#settings' );
|
| 3864 |
+
}
|
| 3865 |
+
|
| 3866 |
$url = $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array(
|
| 3867 |
'utm_campaign' => 'error+messages',
|
| 3868 |
), 'bucket-restrictions' );
|
| 3885 |
*
|
| 3886 |
* @return float|int
|
| 3887 |
*/
|
| 3888 |
+
function multisite_get_space_used( $space_used ) {
|
| 3889 |
global $wpdb;
|
| 3890 |
|
| 3891 |
// Sum the total file size (including image sizes) for all S3 attachments
|
| 4077 |
}
|
| 4078 |
|
| 4079 |
$url = $this->dbrains_url( $path, $args, $hash );
|
| 4080 |
+
$text = __( 'More info »', 'amazon-s3-and-cloudfront' );
|
| 4081 |
$link = AS3CF_Utils::dbrains_link( $url, $text );
|
| 4082 |
|
| 4083 |
+
return sprintf( '<span class="more-info">%s</span>', $link );
|
| 4084 |
}
|
| 4085 |
|
| 4086 |
/**
|
| 4519 |
|
| 4520 |
return $errors;
|
| 4521 |
}
|
| 4522 |
+
|
| 4523 |
+
/**
|
| 4524 |
+
* Get all defined addons that use this plugin
|
| 4525 |
+
*
|
| 4526 |
+
* @param bool $unfiltered
|
| 4527 |
+
*
|
| 4528 |
+
* @return array
|
| 4529 |
+
*/
|
| 4530 |
+
public function get_addons( $unfiltered = false ) {
|
| 4531 |
+
$addons = $this->get_available_addons();
|
| 4532 |
+
|
| 4533 |
+
if ( $unfiltered ) {
|
| 4534 |
+
return $addons;
|
| 4535 |
+
}
|
| 4536 |
+
|
| 4537 |
+
return apply_filters( 'as3cf_addons', $addons );
|
| 4538 |
+
}
|
| 4539 |
+
|
| 4540 |
+
/**
|
| 4541 |
+
* @return array
|
| 4542 |
+
*/
|
| 4543 |
+
protected function get_available_addons() {
|
| 4544 |
+
return array(
|
| 4545 |
+
'amazon-s3-and-cloudfront-assets-pull' => array(
|
| 4546 |
+
'title' => __( 'Assets Pull', 'amazon-s3-and-cloudfront' ),
|
| 4547 |
+
'sub' => __( 'An addon for WP Offload S3 to serve your site\'s JS, CSS, and other enqueued assets from Amazon CloudFront or another CDN.', 'amazon-s3-and-cloudfront'),
|
| 4548 |
+
'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-pull-addon/', array(
|
| 4549 |
+
'utm_campaign' => 'addons+install',
|
| 4550 |
+
) ),
|
| 4551 |
+
'label' => __( 'Feature', 'amazon-s3-and-cloudfront' ),
|
| 4552 |
+
'icon' => true,
|
| 4553 |
+
'active' => class_exists( 'Amazon_S3_And_CloudFront_Assets_Pull' ),
|
| 4554 |
+
),
|
| 4555 |
+
);
|
| 4556 |
+
}
|
| 4557 |
+
|
| 4558 |
+
/**
|
| 4559 |
+
* Get the URL of the addon's icon
|
| 4560 |
+
*
|
| 4561 |
+
* @param string $slug
|
| 4562 |
+
*
|
| 4563 |
+
* @return string
|
| 4564 |
+
*/
|
| 4565 |
+
function get_addon_icon_url( $slug ) {
|
| 4566 |
+
$filename = str_replace( 'amazon-s3-and-cloudfront-', '', $slug );
|
| 4567 |
+
$filename = 'icon-' . $filename . '.svg';
|
| 4568 |
+
|
| 4569 |
+
return plugins_url( 'assets/img/' . $filename, $this->plugin_file_path );
|
| 4570 |
+
}
|
| 4571 |
+
|
| 4572 |
+
/**
|
| 4573 |
+
* Polyfill for displaying "Settings saved." consistently between single-site and multisite environments.
|
| 4574 |
+
*
|
| 4575 |
+
* TL;DR: options-head.php is loaded for options-general.php (single sites only) which does this, but not on multisite.
|
| 4576 |
+
*
|
| 4577 |
+
* @see https://github.com/WordPress/WordPress/blob/c2d709e9d6cbe7f9b3c37da0a7c9aae788158124/wp-admin/admin-header.php#L265-L266
|
| 4578 |
+
* @see https://github.com/WordPress/WordPress/blob/9b68e5953406024c75b92f7ebe2aef0385c8956e/wp-admin/options-head.php#L13-L16
|
| 4579 |
+
*/
|
| 4580 |
+
public function settings_saved_notice() {
|
| 4581 |
+
if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {
|
| 4582 |
+
// For back-compat with plugins that don't use the Settings API and just set updated=1 in the redirect.
|
| 4583 |
+
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
| 4584 |
+
}
|
| 4585 |
+
|
| 4586 |
+
settings_errors();
|
| 4587 |
+
}
|
| 4588 |
+
|
| 4589 |
+
/**
|
| 4590 |
+
* Migrate access keys from AWS database setting to this plugin's settings record and raise any notices.
|
| 4591 |
+
*/
|
| 4592 |
+
private function handle_aws_access_key_migration() {
|
| 4593 |
+
add_action( 'aws_access_key_form_header', array( $this, 'handle_aws_access_key_form_header' ) );
|
| 4594 |
+
|
| 4595 |
+
if ( class_exists( '\Amazon_Web_Services' ) ) {
|
| 4596 |
+
$message = sprintf(
|
| 4597 |
+
__( '<strong>Amazon Web Services Plugin No Longer Required</strong> — As of version 1.6 of WP Offload S3, the <a href="%1$s">Amazon Web Services</a> plugin is no longer required. We have removed the dependency by bundling a small portion of the AWS SDK into WP Offload S3. As long as none of your other active plugins or themes depend on the Amazon Web Services plugin, it should be safe to deactivate and delete it. %2$s', 'amazon-s3-and-cloudfront' ),
|
| 4598 |
+
'https://wordpress.org/plugins/amazon-web-services/',
|
| 4599 |
+
$this->more_info_link( '/wp-offload-s3-1-6-released/', 'os3+settings+aws+active' )
|
| 4600 |
+
);
|
| 4601 |
+
$args = array(
|
| 4602 |
+
'only_show_to_user' => false,
|
| 4603 |
+
'only_show_in_settings' => true,
|
| 4604 |
+
'custom_id' => 'aws-plugin-no-longer-required',
|
| 4605 |
+
);
|
| 4606 |
+
$this->notices->add_notice( $message, $args );
|
| 4607 |
+
|
| 4608 |
+
if ( is_a( $this->aws, '\DeliciousBrains\WP_Offload_S3\Amazon_Web_Services' ) && $this->aws->needs_access_keys() ) {
|
| 4609 |
+
// Have access keys been defined in still active AWS plugin's database settings?
|
| 4610 |
+
$aws_settings = get_site_option( \Amazon_Web_Services::SETTINGS_KEY );
|
| 4611 |
+
|
| 4612 |
+
// If both AWS keys set and we already have a bucket set, safe to use the AWS keys.
|
| 4613 |
+
if ( ! empty( $aws_settings['access_key_id'] ) && ! empty( $aws_settings['secret_access_key'] ) && false !== $this->get_setting( 'bucket' ) ) {
|
| 4614 |
+
$this->set_setting( 'aws-access-key-id', $aws_settings['access_key_id'] );
|
| 4615 |
+
$this->set_setting( 'aws-secret-access-key', $aws_settings['secret_access_key'] );
|
| 4616 |
+
$this->save_settings();
|
| 4617 |
+
}
|
| 4618 |
+
}
|
| 4619 |
+
} else {
|
| 4620 |
+
$this->notices->remove_notice_by_id( 'aws-plugin-no-longer-required' );
|
| 4621 |
+
}
|
| 4622 |
+
}
|
| 4623 |
+
|
| 4624 |
+
/**
|
| 4625 |
+
* Create message in AWS access key form that this plugin no longer uses those settings.
|
| 4626 |
+
*/
|
| 4627 |
+
public function handle_aws_access_key_form_header() {
|
| 4628 |
+
$notice['message'] = sprintf(
|
| 4629 |
+
__( '<strong>WP Offload S3 Settings Moved</strong> — You now define your AWS keys for WP Offload S3 in the new <a href="%1$s">Settings tab</a>. Saving settings in the form below will have no effect on WP Offload S3. %2$s', 'amazon-s3-and-cloudfront' ),
|
| 4630 |
+
$this->get_plugin_page_url( array( 'hash' => 'settings' ) ),
|
| 4631 |
+
$this->more_info_link( '/wp-offload-s3-1-6-released/', 'aws+os3+access+keys+setting+moved' )
|
| 4632 |
+
);
|
| 4633 |
+
$notice['inline'] = true;
|
| 4634 |
+
|
| 4635 |
+
$this->render_view( 'notice', $notice );
|
| 4636 |
+
}
|
| 4637 |
}
|
classes/amazon-web-services.php
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace DeliciousBrains\WP_Offload_S3;
|
| 4 |
+
|
| 5 |
+
use AS3CF_Utils;
|
| 6 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws;
|
| 7 |
+
use Exception;
|
| 8 |
+
|
| 9 |
+
class Amazon_Web_Services extends \AS3CF_Plugin_Base {
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* @var
|
| 13 |
+
*/
|
| 14 |
+
private $client;
|
| 15 |
+
|
| 16 |
+
protected $plugin_slug = 'amazon-s3-and-cloudfront';
|
| 17 |
+
|
| 18 |
+
const SETTINGS_KEY = \Amazon_S3_And_CloudFront::SETTINGS_KEY;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Whether or not IAM access keys are needed.
|
| 22 |
+
*
|
| 23 |
+
* Keys are needed if we are not using EC2 roles or not defined/set yet.
|
| 24 |
+
*
|
| 25 |
+
* @return bool
|
| 26 |
+
*/
|
| 27 |
+
public function needs_access_keys() {
|
| 28 |
+
if ( $this->use_ec2_iam_roles() ) {
|
| 29 |
+
return false;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
return ! $this->are_access_keys_set();
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Check if both access key id & secret are present.
|
| 37 |
+
*
|
| 38 |
+
* @return bool
|
| 39 |
+
*/
|
| 40 |
+
function are_access_keys_set() {
|
| 41 |
+
return $this->get_access_key_id() && $this->get_secret_access_key();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Get the AWS key from a constant or the settings.
|
| 46 |
+
*
|
| 47 |
+
* Falls back to settings only if neither constant is defined.
|
| 48 |
+
*
|
| 49 |
+
* @return string
|
| 50 |
+
*/
|
| 51 |
+
public function get_access_key_id() {
|
| 52 |
+
if ( $this->is_any_access_key_constant_defined() ) {
|
| 53 |
+
$constant = $this->access_key_id_constant();
|
| 54 |
+
|
| 55 |
+
return $constant ? constant( $constant ) : '';
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
return $this->get_setting( 'aws-access-key-id' );
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Get the AWS secret from a constant or the settings
|
| 63 |
+
*
|
| 64 |
+
* Falls back to settings only if neither constant is defined.
|
| 65 |
+
*
|
| 66 |
+
* @return string
|
| 67 |
+
*/
|
| 68 |
+
public function get_secret_access_key() {
|
| 69 |
+
if ( $this->is_any_access_key_constant_defined() ) {
|
| 70 |
+
$constant = $this->secret_access_key_constant();
|
| 71 |
+
|
| 72 |
+
return $constant ? constant( $constant ) : '';
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
return $this->get_setting( 'aws-secret-access-key' );
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Check if any access key (id or secret, prefixed or not) is defined.
|
| 80 |
+
*
|
| 81 |
+
* @return bool
|
| 82 |
+
*/
|
| 83 |
+
public static function is_any_access_key_constant_defined() {
|
| 84 |
+
return static::access_key_id_constant() || static::secret_access_key_constant();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Allows the AWS client factory to use the IAM role for EC2 instances
|
| 89 |
+
* instead of key/secret for credentials
|
| 90 |
+
* http://docs.aws.amazon.com/aws-sdk-php/guide/latest/credentials.html#instance-profile-credentials
|
| 91 |
+
*
|
| 92 |
+
* @return bool
|
| 93 |
+
*/
|
| 94 |
+
public function use_ec2_iam_roles() {
|
| 95 |
+
$constant = $this->use_ec2_iam_role_constant();
|
| 96 |
+
|
| 97 |
+
return $constant && constant( $constant );
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* Get the constant used to define the aws access key id.
|
| 102 |
+
*
|
| 103 |
+
* @return string|false Constant name if defined, otherwise false
|
| 104 |
+
*/
|
| 105 |
+
public static function access_key_id_constant() {
|
| 106 |
+
return AS3CF_Utils::get_first_defined_constant( array(
|
| 107 |
+
'AS3CF_AWS_ACCESS_KEY_ID',
|
| 108 |
+
'DBI_AWS_ACCESS_KEY_ID',
|
| 109 |
+
'AWS_ACCESS_KEY_ID',
|
| 110 |
+
) );
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/**
|
| 114 |
+
* Get the constant used to define the aws secret access key.
|
| 115 |
+
*
|
| 116 |
+
* @return string|false Constant name if defined, otherwise false
|
| 117 |
+
*/
|
| 118 |
+
public static function secret_access_key_constant() {
|
| 119 |
+
return AS3CF_Utils::get_first_defined_constant( array(
|
| 120 |
+
'AS3CF_AWS_SECRET_ACCESS_KEY',
|
| 121 |
+
'DBI_AWS_SECRET_ACCESS_KEY',
|
| 122 |
+
'AWS_SECRET_ACCESS_KEY',
|
| 123 |
+
) );
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* Get the constant used to enable the use of EC2 IAM roles.
|
| 128 |
+
*
|
| 129 |
+
* @return string|false Constant name if defined, otherwise false
|
| 130 |
+
*/
|
| 131 |
+
public static function use_ec2_iam_role_constant() {
|
| 132 |
+
return AS3CF_Utils::get_first_defined_constant( array(
|
| 133 |
+
'AS3CF_AWS_USE_EC2_IAM_ROLE',
|
| 134 |
+
'DBI_AWS_USE_EC2_IAM_ROLE',
|
| 135 |
+
'AWS_USE_EC2_IAM_ROLE',
|
| 136 |
+
) );
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Instantiate a new AWS service client for the AWS SDK
|
| 141 |
+
* using the defined AWS key and secret
|
| 142 |
+
*
|
| 143 |
+
* @return Aws
|
| 144 |
+
* @throws Exception
|
| 145 |
+
*/
|
| 146 |
+
function get_client() {
|
| 147 |
+
if ( $this->needs_access_keys() ) {
|
| 148 |
+
throw new Exception( sprintf( __( 'You must first <a href="%s">set your AWS access keys</a> to use this addon.', 'amazon-s3-and-cloudfront' ), $this->get_plugin_page_url() . '#settings' ) );
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
if ( is_null( $this->client ) ) {
|
| 152 |
+
$args = array();
|
| 153 |
+
|
| 154 |
+
if ( ! $this->use_ec2_iam_roles() ) {
|
| 155 |
+
$args = array(
|
| 156 |
+
'key' => $this->get_access_key_id(),
|
| 157 |
+
'secret' => $this->get_secret_access_key(),
|
| 158 |
+
);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
$args = apply_filters( 'aws_get_client_args', $args );
|
| 162 |
+
$this->client = Aws::factory( $args );
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
return $this->client;
|
| 166 |
+
}
|
| 167 |
+
}
|
classes/{wp-aws-compatibility-check.php → as3cf-compatibility-check.php}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
-
*
|
| 4 |
*
|
| 5 |
* @package wp-aws
|
| 6 |
* @copyright Copyright (c) 2015, Delicious Brains
|
|
@@ -14,16 +14,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 14 |
}
|
| 15 |
|
| 16 |
// Check if already defined
|
| 17 |
-
if ( ! class_exists( '
|
| 18 |
|
| 19 |
/**
|
| 20 |
-
*
|
| 21 |
*
|
| 22 |
* This class handles compatibility between an AWS plugin and a required parent plugin
|
| 23 |
*
|
| 24 |
* @since 0.1
|
| 25 |
*/
|
| 26 |
-
class
|
|
|
|
| 27 |
/**
|
| 28 |
* @var string The derived key of the plugin from the name, e.g. amazon-s3-and-cloudfront
|
| 29 |
*/
|
|
@@ -241,7 +242,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 241 |
$page = 'plugins';
|
| 242 |
|
| 243 |
if ( in_array( $action, array( 'upgrade', 'install' ) ) ) {
|
| 244 |
-
$page
|
| 245 |
$action .= '-plugin';
|
| 246 |
}
|
| 247 |
|
|
@@ -306,23 +307,31 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 306 |
*
|
| 307 |
* @return string|bool
|
| 308 |
*/
|
| 309 |
-
function get_error_msg() {
|
| 310 |
-
if ( is_null( $this->parent_plugin_slug ) ) {
|
| 311 |
-
return false;
|
| 312 |
-
}
|
| 313 |
-
|
| 314 |
if ( ! is_null( $this->error_message ) ) {
|
| 315 |
return $this->error_message;
|
| 316 |
}
|
| 317 |
|
| 318 |
-
$plugin_basename
|
| 319 |
-
$parent_basename = $this->get_parent_plugin_basename();
|
| 320 |
-
$parent_plugin_link_html = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $this->get_parent_plugin_url(), $this->get_parent_plugin_name() );
|
| 321 |
-
|
| 322 |
$deactivate_url = $this->get_plugin_action_url( 'deactivate', $plugin_basename );
|
| 323 |
$deactivate_link = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $deactivate_url, __( 'deactivate', 'amazon-s3-and-cloudfront' ) );
|
| 324 |
$hide_notice_msg = '<br><em>' . sprintf( __( 'You can %s the %s plugin to get rid of this notice.', 'amazon-s3-and-cloudfront' ), $deactivate_link, $this->plugin_name ) . '</em>';
|
| 325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
if ( ! $this->is_parent_plugin_enabled() ) {
|
| 327 |
$msg = sprintf( __( '%s has been disabled as it requires the %s plugin.', 'amazon-s3-and-cloudfront' ), $this->plugin_name, $parent_plugin_link_html );
|
| 328 |
|
|
@@ -330,9 +339,9 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 330 |
if ( isset( $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) && ! $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) {
|
| 331 |
$msg = rtrim( $msg, '.' ) . ', ' . __( 'which is currently disabled.', 'amazon-s3-and-cloudfront' );
|
| 332 |
} else {
|
| 333 |
-
$msg
|
| 334 |
$activate_url = $this->get_plugin_action_url( 'activate', $parent_basename );
|
| 335 |
-
$msg
|
| 336 |
}
|
| 337 |
} else {
|
| 338 |
$install_url = 'https://deliciousbrains.com/my-account/';
|
|
@@ -368,8 +377,8 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 368 |
}
|
| 369 |
|
| 370 |
$update_url = $this->get_plugin_action_url( 'upgrade', $parent_basename );
|
| 371 |
-
$msg .= ' <a style="font-weight:bold;text-decoration:none;white-space:nowrap;" href="' . $update_url . '">' . __( 'Update to the latest version', 'amazon-s3-and-cloudfront' ) . '</a>';
|
| 372 |
|
|
|
|
| 373 |
$msg .= $hide_notice_msg;
|
| 374 |
|
| 375 |
return $this->set_error_msg( $msg );
|
|
@@ -438,7 +447,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 438 |
* Display compatibility notices to users who can manage plugins
|
| 439 |
*/
|
| 440 |
function hook_admin_notices() {
|
| 441 |
-
if ( ! $this->check_capabilities() ){
|
| 442 |
return;
|
| 443 |
}
|
| 444 |
|
|
@@ -479,7 +488,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 479 |
* @param string $message
|
| 480 |
*/
|
| 481 |
function render_notice( $message ) {
|
| 482 |
-
printf( '<div id="
|
| 483 |
}
|
| 484 |
|
| 485 |
/**
|
|
@@ -520,5 +529,152 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
| 520 |
|
| 521 |
return self::$is_installing_or_updating_plugins;
|
| 522 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 523 |
}
|
| 524 |
}
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
+
* AS3CF Compatibility Check
|
| 4 |
*
|
| 5 |
* @package wp-aws
|
| 6 |
* @copyright Copyright (c) 2015, Delicious Brains
|
| 14 |
}
|
| 15 |
|
| 16 |
// Check if already defined
|
| 17 |
+
if ( ! class_exists( 'AS3CF_Compatibility_Check' ) ) {
|
| 18 |
|
| 19 |
/**
|
| 20 |
+
* AS3CF_Compatibility_Check Class
|
| 21 |
*
|
| 22 |
* This class handles compatibility between an AWS plugin and a required parent plugin
|
| 23 |
*
|
| 24 |
* @since 0.1
|
| 25 |
*/
|
| 26 |
+
class AS3CF_Compatibility_Check {
|
| 27 |
+
|
| 28 |
/**
|
| 29 |
* @var string The derived key of the plugin from the name, e.g. amazon-s3-and-cloudfront
|
| 30 |
*/
|
| 242 |
$page = 'plugins';
|
| 243 |
|
| 244 |
if ( in_array( $action, array( 'upgrade', 'install' ) ) ) {
|
| 245 |
+
$page = 'update';
|
| 246 |
$action .= '-plugin';
|
| 247 |
}
|
| 248 |
|
| 307 |
*
|
| 308 |
* @return string|bool
|
| 309 |
*/
|
| 310 |
+
public function get_error_msg() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
if ( ! is_null( $this->error_message ) ) {
|
| 312 |
return $this->error_message;
|
| 313 |
}
|
| 314 |
|
| 315 |
+
$plugin_basename = $this->get_plugin_basename();
|
|
|
|
|
|
|
|
|
|
| 316 |
$deactivate_url = $this->get_plugin_action_url( 'deactivate', $plugin_basename );
|
| 317 |
$deactivate_link = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $deactivate_url, __( 'deactivate', 'amazon-s3-and-cloudfront' ) );
|
| 318 |
$hide_notice_msg = '<br><em>' . sprintf( __( 'You can %s the %s plugin to get rid of this notice.', 'amazon-s3-and-cloudfront' ), $deactivate_link, $this->plugin_name ) . '</em>';
|
| 319 |
|
| 320 |
+
// Check basic requirements for AWS SDK.
|
| 321 |
+
$sdk_errors = $this->get_sdk_requirements_errors();
|
| 322 |
+
if ( ! empty( $sdk_errors ) ) {
|
| 323 |
+
$sdk_errors = $this->get_sdk_error_msg() . $hide_notice_msg;
|
| 324 |
+
return $this->set_error_msg( $sdk_errors );
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
// Remainder of tests are for addons.
|
| 328 |
+
if ( is_null( $this->parent_plugin_slug ) ) {
|
| 329 |
+
return false;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
$parent_basename = $this->get_parent_plugin_basename();
|
| 333 |
+
$parent_plugin_link_html = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $this->get_parent_plugin_url(), $this->get_parent_plugin_name() );
|
| 334 |
+
|
| 335 |
if ( ! $this->is_parent_plugin_enabled() ) {
|
| 336 |
$msg = sprintf( __( '%s has been disabled as it requires the %s plugin.', 'amazon-s3-and-cloudfront' ), $this->plugin_name, $parent_plugin_link_html );
|
| 337 |
|
| 339 |
if ( isset( $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) && ! $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) {
|
| 340 |
$msg = rtrim( $msg, '.' ) . ', ' . __( 'which is currently disabled.', 'amazon-s3-and-cloudfront' );
|
| 341 |
} else {
|
| 342 |
+
$msg .= ' ' . __( 'It appears to be installed already.', 'amazon-s3-and-cloudfront' );
|
| 343 |
$activate_url = $this->get_plugin_action_url( 'activate', $parent_basename );
|
| 344 |
+
$msg .= ' <a id="' . $this->plugin_slug . '-activate-parent" style="font-weight:bold;text-decoration:none;" href="' . $activate_url . '">' . _x( 'Activate it now.', 'Activate plugin', 'amazon-s3-and-cloudfront' ) . '</a>';
|
| 345 |
}
|
| 346 |
} else {
|
| 347 |
$install_url = 'https://deliciousbrains.com/my-account/';
|
| 377 |
}
|
| 378 |
|
| 379 |
$update_url = $this->get_plugin_action_url( 'upgrade', $parent_basename );
|
|
|
|
| 380 |
|
| 381 |
+
$msg .= ' <a style="font-weight:bold;text-decoration:none;white-space:nowrap;" href="' . $update_url . '">' . __( 'Update to the latest version', 'amazon-s3-and-cloudfront' ) . '</a>';
|
| 382 |
$msg .= $hide_notice_msg;
|
| 383 |
|
| 384 |
return $this->set_error_msg( $msg );
|
| 447 |
* Display compatibility notices to users who can manage plugins
|
| 448 |
*/
|
| 449 |
function hook_admin_notices() {
|
| 450 |
+
if ( ! $this->check_capabilities() ) {
|
| 451 |
return;
|
| 452 |
}
|
| 453 |
|
| 488 |
* @param string $message
|
| 489 |
*/
|
| 490 |
function render_notice( $message ) {
|
| 491 |
+
printf( '<div id="as3cf-compat-notice' . $this->plugin_slug . '" class="' . $this->notice_class . ' as3cf-compatibility-notice"><p>%s</p></div>', $message );
|
| 492 |
}
|
| 493 |
|
| 494 |
/**
|
| 529 |
|
| 530 |
return self::$is_installing_or_updating_plugins;
|
| 531 |
}
|
| 532 |
+
|
| 533 |
+
/**
|
| 534 |
+
* Checks if another version of WP Offload S3 (Lite) is active and deactivates it.
|
| 535 |
+
* To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
|
| 536 |
+
*
|
| 537 |
+
* @param string $plugin
|
| 538 |
+
*
|
| 539 |
+
* @return bool
|
| 540 |
+
*/
|
| 541 |
+
public static function deactivate_other_instances( $plugin ) {
|
| 542 |
+
if ( ! in_array( basename( $plugin ), array( 'amazon-s3-and-cloudfront-pro.php', 'wordpress-s3.php' ) ) ) {
|
| 543 |
+
return false;
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
$plugin_to_deactivate = 'wordpress-s3.php';
|
| 547 |
+
$deactivated_notice_id = '1';
|
| 548 |
+
$activated_plugin_min_version = '1.1';
|
| 549 |
+
$plugin_to_deactivate_min_version = '1.0';
|
| 550 |
+
if ( basename( $plugin ) === $plugin_to_deactivate ) {
|
| 551 |
+
$plugin_to_deactivate = 'amazon-s3-and-cloudfront-pro.php';
|
| 552 |
+
$deactivated_notice_id = '2';
|
| 553 |
+
$activated_plugin_min_version = '1.0';
|
| 554 |
+
$plugin_to_deactivate_min_version = '1.1';
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
$version = self::get_plugin_version_from_basename( $plugin );
|
| 558 |
+
|
| 559 |
+
if ( version_compare( $version, $activated_plugin_min_version, '<' ) ) {
|
| 560 |
+
return false;
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
if ( is_multisite() ) {
|
| 564 |
+
$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
|
| 565 |
+
$active_plugins = array_keys( $active_plugins );
|
| 566 |
+
} else {
|
| 567 |
+
$active_plugins = (array) get_option( 'active_plugins', array() );
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
foreach ( $active_plugins as $basename ) {
|
| 571 |
+
if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
|
| 572 |
+
$version = self::get_plugin_version_from_basename( $basename );
|
| 573 |
+
|
| 574 |
+
if ( version_compare( $version, $plugin_to_deactivate_min_version, '<' ) ) {
|
| 575 |
+
return false;
|
| 576 |
+
}
|
| 577 |
+
|
| 578 |
+
set_transient( 'as3cf_deactivated_notice_id', $deactivated_notice_id, HOUR_IN_SECONDS );
|
| 579 |
+
deactivate_plugins( $basename );
|
| 580 |
+
|
| 581 |
+
return true;
|
| 582 |
+
}
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
return false;
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
/**
|
| 589 |
+
* Get plugin data from basename
|
| 590 |
+
*
|
| 591 |
+
* @param string $basename
|
| 592 |
+
*
|
| 593 |
+
* @return string
|
| 594 |
+
*/
|
| 595 |
+
public static function get_plugin_version_from_basename( $basename ) {
|
| 596 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
| 597 |
+
|
| 598 |
+
$plugin_path = WP_PLUGIN_DIR . '/' . $basename;
|
| 599 |
+
$plugin_data = get_plugin_data( $plugin_path );
|
| 600 |
+
|
| 601 |
+
return $plugin_data['Version'];
|
| 602 |
+
}
|
| 603 |
+
|
| 604 |
+
/**
|
| 605 |
+
* Return an array of issues with the server's compatibility with the AWS SDK
|
| 606 |
+
*
|
| 607 |
+
* @return array
|
| 608 |
+
*/
|
| 609 |
+
public function get_sdk_requirements_errors() {
|
| 610 |
+
static $errors;
|
| 611 |
+
|
| 612 |
+
if ( ! is_null( $errors ) ) {
|
| 613 |
+
return $errors;
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
$errors = array();
|
| 617 |
+
|
| 618 |
+
if ( version_compare( PHP_VERSION, '5.3.3', '<' ) ) {
|
| 619 |
+
$errors[] = __( 'a PHP version less than 5.3.3', 'amazon-s3-and-cloudfront' );
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
if ( ! function_exists( 'curl_version' ) ) {
|
| 623 |
+
$errors[] = __( 'no PHP cURL library activated', 'amazon-s3-and-cloudfront' );
|
| 624 |
+
|
| 625 |
+
return $errors;
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
if ( ! ( $curl = curl_version() ) || empty( $curl['version'] ) || empty( $curl['features'] ) || version_compare( $curl['version'], '7.16.2', '<' ) ) {
|
| 629 |
+
$errors[] = __( 'a cURL version less than 7.16.2', 'amazon-s3-and-cloudfront' );
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
if ( ! empty( $curl['features'] ) ) {
|
| 633 |
+
$curl_errors = array();
|
| 634 |
+
|
| 635 |
+
if ( ! CURL_VERSION_SSL ) {
|
| 636 |
+
$curl_errors[] = 'OpenSSL';
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
if ( ! CURL_VERSION_LIBZ ) {
|
| 640 |
+
$curl_errors[] = 'zlib';
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
if ( $curl_errors ) {
|
| 644 |
+
$errors[] = __( 'cURL compiled without', 'amazon-s3-and-cloudfront' ) . ' ' . implode( ' or ', $curl_errors ); // xss ok
|
| 645 |
+
}
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
if ( ! function_exists( 'curl_multi_exec' ) ) {
|
| 649 |
+
$errors[] = __( 'the function curl_multi_exec disabled', 'amazon-s3-and-cloudfront' );
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
return $errors;
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
/**
|
| 656 |
+
* Prepare an error message with compatibility issues
|
| 657 |
+
*
|
| 658 |
+
* @return string
|
| 659 |
+
*/
|
| 660 |
+
public function get_sdk_error_msg() {
|
| 661 |
+
$errors = $this->get_sdk_requirements_errors();
|
| 662 |
+
|
| 663 |
+
if ( ! $errors ) {
|
| 664 |
+
return '';
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
$msg = __( 'The official Amazon Web Services SDK requires PHP 5.3.3+ and cURL 7.16.2+ compiled with OpenSSL and zlib. Your server currently has', 'amazon-s3-and-cloudfront' );
|
| 668 |
+
|
| 669 |
+
if ( count( $errors ) > 1 ) {
|
| 670 |
+
$last_one = ' and ' . array_pop( $errors );
|
| 671 |
+
} else {
|
| 672 |
+
$last_one = '';
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
$msg .= ' ' . implode( ', ', $errors ) . $last_one . '.';
|
| 676 |
+
|
| 677 |
+
return $msg;
|
| 678 |
+
}
|
| 679 |
}
|
| 680 |
}
|
classes/as3cf-filter.php
CHANGED
|
@@ -621,11 +621,25 @@ abstract class AS3CF_Filter {
|
|
| 621 |
foreach ( $url_pairs as $find => $replace ) {
|
| 622 |
$replace = $this->normalize_replace_value( $replace );
|
| 623 |
$content = str_replace( $find, $replace, $content );
|
|
|
|
| 624 |
}
|
| 625 |
|
| 626 |
return $content;
|
| 627 |
}
|
| 628 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
/**
|
| 630 |
* Get post cache
|
| 631 |
*
|
| 621 |
foreach ( $url_pairs as $find => $replace ) {
|
| 622 |
$replace = $this->normalize_replace_value( $replace );
|
| 623 |
$content = str_replace( $find, $replace, $content );
|
| 624 |
+
$content = $this->url_replaced( $find, $replace, $content );
|
| 625 |
}
|
| 626 |
|
| 627 |
return $content;
|
| 628 |
}
|
| 629 |
|
| 630 |
+
/**
|
| 631 |
+
* Each time a URL is replaced this function is called to allow for logging or further updates etc.
|
| 632 |
+
*
|
| 633 |
+
* @param string $find URL with no scheme.
|
| 634 |
+
* @param string $replace URL with no scheme.
|
| 635 |
+
* @param string $content
|
| 636 |
+
*
|
| 637 |
+
* @return string
|
| 638 |
+
*/
|
| 639 |
+
protected function url_replaced( $find, $replace, $content ) {
|
| 640 |
+
return $content;
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
/**
|
| 644 |
* Get post cache
|
| 645 |
*
|
classes/as3cf-plugin-base.php
ADDED
|
@@ -0,0 +1,605 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
abstract class AS3CF_Plugin_Base {
|
| 4 |
+
|
| 5 |
+
const DBRAINS_URL = 'https://deliciousbrains.com';
|
| 6 |
+
|
| 7 |
+
const SETTINGS_KEY = '';
|
| 8 |
+
const SETTINGS_CONSTANT = '';
|
| 9 |
+
|
| 10 |
+
protected static $plugin_page = 'amazon-s3-and-cloudfront';
|
| 11 |
+
protected $default_tab = '';
|
| 12 |
+
|
| 13 |
+
protected $plugin_file_path;
|
| 14 |
+
protected $plugin_dir_path;
|
| 15 |
+
protected $plugin_slug;
|
| 16 |
+
protected $plugin_basename;
|
| 17 |
+
protected $plugin_version;
|
| 18 |
+
protected $plugin_pagenow;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* @var array
|
| 22 |
+
*/
|
| 23 |
+
private $settings;
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* @var array
|
| 27 |
+
*/
|
| 28 |
+
private $defined_settings;
|
| 29 |
+
|
| 30 |
+
function __construct( $plugin_file_path ) {
|
| 31 |
+
$this->plugin_file_path = $plugin_file_path;
|
| 32 |
+
$this->plugin_dir_path = rtrim( plugin_dir_path( $plugin_file_path ), '/' );
|
| 33 |
+
$this->plugin_basename = plugin_basename( $plugin_file_path );
|
| 34 |
+
$this->plugin_pagenow = is_multisite() ? 'settings.php' : 'options-general.php';
|
| 35 |
+
|
| 36 |
+
if ( $this->plugin_slug && isset( $GLOBALS['aws_meta'][ $this->plugin_slug ]['version'] ) ) {
|
| 37 |
+
$this->plugin_version = $GLOBALS['aws_meta'][ $this->plugin_slug ]['version'];
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Accessor for plugin version
|
| 43 |
+
*
|
| 44 |
+
* @return mixed
|
| 45 |
+
*/
|
| 46 |
+
public function get_plugin_version() {
|
| 47 |
+
return $this->plugin_version;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Accessor for plugin slug
|
| 52 |
+
*
|
| 53 |
+
* @return string
|
| 54 |
+
*/
|
| 55 |
+
public function get_plugin_slug() {
|
| 56 |
+
return $this->plugin_slug;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Accessor for plugin basename
|
| 61 |
+
*
|
| 62 |
+
* @return string
|
| 63 |
+
*/
|
| 64 |
+
public function get_plugin_basename() {
|
| 65 |
+
return $this->plugin_basename;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Accessor for plugin file path
|
| 70 |
+
*
|
| 71 |
+
* @return string
|
| 72 |
+
*/
|
| 73 |
+
public function get_plugin_file_path() {
|
| 74 |
+
return $this->plugin_file_path;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Accessor for plugin dir path
|
| 79 |
+
*
|
| 80 |
+
* @return string
|
| 81 |
+
*/
|
| 82 |
+
public function get_plugin_dir_path() {
|
| 83 |
+
return $this->plugin_dir_path;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Accessor for plugin_pagenow
|
| 88 |
+
*
|
| 89 |
+
* @return string
|
| 90 |
+
*/
|
| 91 |
+
public function get_plugin_pagenow() {
|
| 92 |
+
return $this->plugin_pagenow;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Get the plugin's settings array
|
| 97 |
+
*
|
| 98 |
+
* @param bool $force
|
| 99 |
+
*
|
| 100 |
+
* @return array
|
| 101 |
+
*/
|
| 102 |
+
function get_settings( $force = false ) {
|
| 103 |
+
if ( is_null( $this->settings ) || $force ) {
|
| 104 |
+
$this->settings = $this->filter_settings( get_site_option( static::SETTINGS_KEY ) );
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
return $this->settings;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Get all settings that have been defined via constant for the plugin
|
| 112 |
+
*
|
| 113 |
+
* @param bool $force
|
| 114 |
+
*
|
| 115 |
+
* @return array
|
| 116 |
+
*/
|
| 117 |
+
function get_defined_settings( $force = false ) {
|
| 118 |
+
if ( ! defined( static::SETTINGS_CONSTANT ) ) {
|
| 119 |
+
$this->defined_settings = array();
|
| 120 |
+
|
| 121 |
+
return $this->defined_settings;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
if ( is_null( $this->defined_settings ) || $force ) {
|
| 125 |
+
$this->defined_settings = array();
|
| 126 |
+
$unserialized = maybe_unserialize( constant( static::SETTINGS_CONSTANT ) );
|
| 127 |
+
$unserialized = is_array( $unserialized ) ? $unserialized : array();
|
| 128 |
+
|
| 129 |
+
foreach ( $unserialized as $key => $value ) {
|
| 130 |
+
if ( ! in_array( $key, $this->get_settings_whitelist() ) ) {
|
| 131 |
+
continue;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
if ( is_bool( $value ) || is_null( $value ) ) {
|
| 135 |
+
$value = (int) $value;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
if ( is_numeric( $value ) ) {
|
| 139 |
+
$value = strval( $value );
|
| 140 |
+
} else {
|
| 141 |
+
$value = $this->sanitize_setting( $key, $value );
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
$this->defined_settings[ $key ] = $value;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
$this->listen_for_settings_constant_changes();
|
| 148 |
+
|
| 149 |
+
// Normalize the defined settings before saving, so we can detect when a real change happens.
|
| 150 |
+
ksort( $this->defined_settings );
|
| 151 |
+
update_site_option( 'as3cf_constant_' . static::SETTINGS_CONSTANT, $this->defined_settings );
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
return $this->defined_settings;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
/**
|
| 158 |
+
* Subscribe to changes of the site option used to store the constant-defined settings.
|
| 159 |
+
*/
|
| 160 |
+
protected function listen_for_settings_constant_changes() {
|
| 161 |
+
if ( ! has_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array(
|
| 162 |
+
$this,
|
| 163 |
+
'settings_constant_changed',
|
| 164 |
+
) ) ) {
|
| 165 |
+
add_action( 'add_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array(
|
| 166 |
+
$this,
|
| 167 |
+
'settings_constant_added',
|
| 168 |
+
), 10, 3 );
|
| 169 |
+
add_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array(
|
| 170 |
+
$this,
|
| 171 |
+
'settings_constant_changed',
|
| 172 |
+
), 10, 4 );
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Translate a settings constant option addition into a change.
|
| 178 |
+
*
|
| 179 |
+
* @param string $option Name of the option.
|
| 180 |
+
* @param mixed $value Value the option is being initialized with.
|
| 181 |
+
* @param int $network_id ID of the network.
|
| 182 |
+
*/
|
| 183 |
+
public function settings_constant_added( $option, $value, $network_id ) {
|
| 184 |
+
$db_settings = get_site_option( static::SETTINGS_KEY, array() );
|
| 185 |
+
$this->settings_constant_changed( $option, $value, $db_settings, $network_id );
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
/**
|
| 189 |
+
* Callback for announcing when settings-defined values change.
|
| 190 |
+
*
|
| 191 |
+
* @param string $option Name of the option.
|
| 192 |
+
* @param mixed $new_settings Current value of the option.
|
| 193 |
+
* @param mixed $old_settings Old value of the option.
|
| 194 |
+
* @param int $network_id ID of the network.
|
| 195 |
+
*/
|
| 196 |
+
public function settings_constant_changed( $option, $new_settings, $old_settings, $network_id ) {
|
| 197 |
+
$old_settings = $old_settings ?: array();
|
| 198 |
+
|
| 199 |
+
foreach ( $this->get_settings_whitelist() as $setting ) {
|
| 200 |
+
$old_value = isset( $old_settings[ $setting ] ) ? $old_settings[ $setting ] : null;
|
| 201 |
+
$new_value = isset( $new_settings[ $setting ] ) ? $new_settings[ $setting ] : null;
|
| 202 |
+
|
| 203 |
+
if ( $old_value !== $new_value ) {
|
| 204 |
+
/**
|
| 205 |
+
* Setting-specific hook for setting change.
|
| 206 |
+
*
|
| 207 |
+
* @param mixed $new_value
|
| 208 |
+
* @param mixed $old_value
|
| 209 |
+
* @param string $setting
|
| 210 |
+
*/
|
| 211 |
+
do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed_' . $setting, $new_value, $old_value, $setting );
|
| 212 |
+
|
| 213 |
+
/**
|
| 214 |
+
* Generic hook for setting change.
|
| 215 |
+
*
|
| 216 |
+
* @param mixed $new_value
|
| 217 |
+
* @param mixed $old_value
|
| 218 |
+
* @param string $setting
|
| 219 |
+
*/
|
| 220 |
+
do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed', $new_value, $old_value, $setting );
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
/**
|
| 226 |
+
* Filter the plugin settings array
|
| 227 |
+
*
|
| 228 |
+
* @param array $settings
|
| 229 |
+
*
|
| 230 |
+
* @return array $settings
|
| 231 |
+
*/
|
| 232 |
+
function filter_settings( $settings ) {
|
| 233 |
+
$defined_settings = $this->get_defined_settings();
|
| 234 |
+
|
| 235 |
+
// Bail early if there are no defined settings
|
| 236 |
+
if ( empty( $defined_settings ) ) {
|
| 237 |
+
return $settings;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
foreach ( $defined_settings as $key => $value ) {
|
| 241 |
+
$settings[ $key ] = $value;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
return $settings;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
/**
|
| 248 |
+
* Get the whitelisted settings for the plugin.
|
| 249 |
+
* Meant to be overridden in child classes.
|
| 250 |
+
*
|
| 251 |
+
* @return array
|
| 252 |
+
*/
|
| 253 |
+
function get_settings_whitelist() {
|
| 254 |
+
return array();
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
/**
|
| 258 |
+
* List of settings that should skip full sanitize.
|
| 259 |
+
*
|
| 260 |
+
* @return array
|
| 261 |
+
*/
|
| 262 |
+
function get_skip_sanitize_settings() {
|
| 263 |
+
return array();
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
/**
|
| 267 |
+
* Sanitize a setting value, maybe.
|
| 268 |
+
*
|
| 269 |
+
* @param $key
|
| 270 |
+
* @param $value
|
| 271 |
+
*
|
| 272 |
+
* @return string
|
| 273 |
+
*/
|
| 274 |
+
function sanitize_setting( $key, $value ) {
|
| 275 |
+
$skip_sanitize = $this->get_skip_sanitize_settings();
|
| 276 |
+
|
| 277 |
+
if ( in_array( $key, $skip_sanitize ) ) {
|
| 278 |
+
$value = wp_strip_all_tags( $value );
|
| 279 |
+
} else {
|
| 280 |
+
$value = sanitize_text_field( $value );
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
return $value;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
/**
|
| 287 |
+
* Get a specific setting
|
| 288 |
+
*
|
| 289 |
+
* @param $key
|
| 290 |
+
* @param string $default
|
| 291 |
+
*
|
| 292 |
+
* @return string
|
| 293 |
+
*/
|
| 294 |
+
function get_setting( $key, $default = '' ) {
|
| 295 |
+
$this->get_settings();
|
| 296 |
+
|
| 297 |
+
if ( isset( $this->settings[ $key ] ) ) {
|
| 298 |
+
$setting = $this->settings[ $key ];
|
| 299 |
+
} else {
|
| 300 |
+
$setting = $default;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
return apply_filters( 'as3cf_get_setting', $setting, $key );
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
/**
|
| 307 |
+
* Gets a single setting that has been defined in the plugin settings constant
|
| 308 |
+
*
|
| 309 |
+
* @param string $key
|
| 310 |
+
* @param mixed $default
|
| 311 |
+
*
|
| 312 |
+
* @return mixed
|
| 313 |
+
*/
|
| 314 |
+
function get_defined_setting( $key, $default = '' ) {
|
| 315 |
+
$defined_settings = $this->get_defined_settings();
|
| 316 |
+
$setting = isset( $defined_settings[ $key ] ) ? $defined_settings[ $key ] : $default;
|
| 317 |
+
|
| 318 |
+
return $setting;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
/**
|
| 322 |
+
* Delete a setting
|
| 323 |
+
*
|
| 324 |
+
* @param $key
|
| 325 |
+
*/
|
| 326 |
+
function remove_setting( $key ) {
|
| 327 |
+
$this->get_settings();
|
| 328 |
+
|
| 329 |
+
if ( isset( $this->settings[ $key ] ) ) {
|
| 330 |
+
unset( $this->settings[ $key ] );
|
| 331 |
+
}
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
/**
|
| 335 |
+
* Removes a defined setting from the defined_settings array.
|
| 336 |
+
*
|
| 337 |
+
* Does not unset the actual constant.
|
| 338 |
+
*
|
| 339 |
+
* @param $key
|
| 340 |
+
*/
|
| 341 |
+
function remove_defined_setting( $key ) {
|
| 342 |
+
$this->get_defined_settings();
|
| 343 |
+
|
| 344 |
+
if ( isset( $this->defined_settings[ $key ] ) ) {
|
| 345 |
+
unset( $this->defined_settings[ $key ] );
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
/**
|
| 350 |
+
* Render a view template file
|
| 351 |
+
*
|
| 352 |
+
* @param string $view View filename without the extension
|
| 353 |
+
* @param array $args Arguments to pass to the view
|
| 354 |
+
*/
|
| 355 |
+
function render_view( $view, $args = array() ) {
|
| 356 |
+
extract( $args );
|
| 357 |
+
include $this->plugin_dir_path . '/view/' . $view . '.php';
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
/**
|
| 361 |
+
* Set a setting
|
| 362 |
+
*
|
| 363 |
+
* @param $key
|
| 364 |
+
* @param $value
|
| 365 |
+
*/
|
| 366 |
+
function set_setting( $key, $value ) {
|
| 367 |
+
$this->get_settings();
|
| 368 |
+
|
| 369 |
+
$this->settings[ $key ] = $value;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
/**
|
| 373 |
+
* Bulk set the settings array
|
| 374 |
+
*
|
| 375 |
+
* @param array $settings
|
| 376 |
+
*/
|
| 377 |
+
function set_settings( $settings ) {
|
| 378 |
+
$this->settings = $settings;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
/**
|
| 382 |
+
* Save the settings to the database
|
| 383 |
+
*/
|
| 384 |
+
public function save_settings() {
|
| 385 |
+
if ( is_array( $this->settings ) ) {
|
| 386 |
+
ksort( $this->settings );
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
$this->update_site_option( static::SETTINGS_KEY, $this->settings );
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
/**
|
| 393 |
+
* Update site option.
|
| 394 |
+
*
|
| 395 |
+
* @param string $option
|
| 396 |
+
* @param mixed $value
|
| 397 |
+
* @param bool $autoload
|
| 398 |
+
*
|
| 399 |
+
* @return bool
|
| 400 |
+
*/
|
| 401 |
+
public function update_site_option( $option, $value, $autoload = true ) {
|
| 402 |
+
if ( is_multisite() ) {
|
| 403 |
+
return update_site_option( $option, $value );
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
return update_option( $option, $value, $autoload );
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
/**
|
| 410 |
+
* Helper method to return the settings page URL for the plugin
|
| 411 |
+
*
|
| 412 |
+
* @param array $args
|
| 413 |
+
* @param string $url_method To prepend to admin_url()
|
| 414 |
+
* @param bool $escape Should we escape the URL
|
| 415 |
+
*
|
| 416 |
+
* @return string
|
| 417 |
+
*/
|
| 418 |
+
public function get_plugin_page_url( $args = array(), $url_method = 'network', $escape = true ) {
|
| 419 |
+
$default_args = array(
|
| 420 |
+
'page' => static::$plugin_page,
|
| 421 |
+
);
|
| 422 |
+
|
| 423 |
+
$args = array_merge( $default_args, $args );
|
| 424 |
+
|
| 425 |
+
switch ( $url_method ) {
|
| 426 |
+
case 'self':
|
| 427 |
+
$base_url = self_admin_url( $this->get_plugin_pagenow() );
|
| 428 |
+
break;
|
| 429 |
+
default:
|
| 430 |
+
$base_url = network_admin_url( $this->get_plugin_pagenow() );
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
// Add a hash to the URL
|
| 434 |
+
$hash = false;
|
| 435 |
+
if ( isset( $args['hash'] ) ) {
|
| 436 |
+
$hash = $args['hash'];
|
| 437 |
+
unset( $args['hash'] );
|
| 438 |
+
} else if ( $this->default_tab ) {
|
| 439 |
+
$hash = $this->default_tab;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
$url = add_query_arg( $args, $base_url );
|
| 443 |
+
|
| 444 |
+
if ( $hash ) {
|
| 445 |
+
$url .= '#' . $hash;
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
if ( $escape ) {
|
| 449 |
+
$url = esc_url_raw( $url );
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
return $url;
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
/**
|
| 456 |
+
* The text for the plugin action link for the plugin on the plugins page.
|
| 457 |
+
*
|
| 458 |
+
* @return string
|
| 459 |
+
*/
|
| 460 |
+
function get_plugin_action_settings_text() {
|
| 461 |
+
return __( 'Settings', 'amazon-s3-and-cloudfront' );
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
/**
|
| 465 |
+
* Add a link to the plugin row for the plugin on the plugins page.
|
| 466 |
+
* Needs to be implemented for an extending class using -
|
| 467 |
+
* add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
| 468 |
+
*
|
| 469 |
+
* @param array $links
|
| 470 |
+
* @param string $file
|
| 471 |
+
*
|
| 472 |
+
* @return array
|
| 473 |
+
*/
|
| 474 |
+
function plugin_actions_settings_link( $links, $file ) {
|
| 475 |
+
$url = $this->get_plugin_page_url();
|
| 476 |
+
$text = $this->get_plugin_action_settings_text();
|
| 477 |
+
|
| 478 |
+
$settings_link = '<a href="' . $url . '">' . esc_html( $text ) . '</a>';
|
| 479 |
+
|
| 480 |
+
if ( $file == $this->plugin_basename ) {
|
| 481 |
+
array_unshift( $links, $settings_link );
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
return $links;
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
/**
|
| 488 |
+
* Enqueue script.
|
| 489 |
+
*
|
| 490 |
+
* @param string $handle
|
| 491 |
+
* @param string $path
|
| 492 |
+
* @param array $deps
|
| 493 |
+
* @param bool $footer
|
| 494 |
+
*/
|
| 495 |
+
public function enqueue_script( $handle, $path, $deps = array(), $footer = true ) {
|
| 496 |
+
$version = $this->get_asset_version();
|
| 497 |
+
$suffix = $this->get_asset_suffix();
|
| 498 |
+
|
| 499 |
+
$src = plugins_url( $path . $suffix . '.js', $this->plugin_file_path );
|
| 500 |
+
wp_enqueue_script( $handle, $src, $deps, $version, $footer );
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
/**
|
| 504 |
+
* Enqueue style.
|
| 505 |
+
*
|
| 506 |
+
* @param string $handle
|
| 507 |
+
* @param string $path
|
| 508 |
+
* @param array $deps
|
| 509 |
+
*/
|
| 510 |
+
public function enqueue_style( $handle, $path, $deps = array() ) {
|
| 511 |
+
$version = $this->get_asset_version();
|
| 512 |
+
|
| 513 |
+
$src = plugins_url( $path . '.css', $this->plugin_file_path );
|
| 514 |
+
wp_enqueue_style( $handle, $src, $deps, $version );
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
/**
|
| 518 |
+
* Get the version used for script enqueuing
|
| 519 |
+
*
|
| 520 |
+
* @return mixed
|
| 521 |
+
*/
|
| 522 |
+
public function get_asset_version() {
|
| 523 |
+
return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
/**
|
| 527 |
+
* Get the filename suffix used for script enqueuing
|
| 528 |
+
*
|
| 529 |
+
* @return mixed
|
| 530 |
+
*/
|
| 531 |
+
public function get_asset_suffix() {
|
| 532 |
+
return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
/**
|
| 536 |
+
* Get all AWS regions
|
| 537 |
+
*
|
| 538 |
+
* @return array
|
| 539 |
+
*/
|
| 540 |
+
public function get_aws_regions() {
|
| 541 |
+
$regions = array(
|
| 542 |
+
'us-east-1' => 'US Standard',
|
| 543 |
+
'us-west-1' => 'Northern California',
|
| 544 |
+
'us-west-2' => 'Oregon',
|
| 545 |
+
'ca-central-1' => 'Montreal',
|
| 546 |
+
'eu-west-1' => 'Ireland',
|
| 547 |
+
'eu-west-2' => 'London',
|
| 548 |
+
'eu-central-1' => 'Frankfurt',
|
| 549 |
+
'ap-southeast-1' => 'Singapore',
|
| 550 |
+
'ap-southeast-2' => 'Sydney',
|
| 551 |
+
'ap-northeast-1' => 'Tokyo',
|
| 552 |
+
'ap-northeast-2' => 'Seoul',
|
| 553 |
+
'ap-south-1' => 'Mumbai',
|
| 554 |
+
'sa-east-1' => 'Sao Paulo',
|
| 555 |
+
);
|
| 556 |
+
|
| 557 |
+
return apply_filters( 'aws_get_regions', $regions );
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
/**
|
| 561 |
+
* Generate site URL with correct UTM tags.
|
| 562 |
+
*
|
| 563 |
+
* @param string $path
|
| 564 |
+
* @param array $args
|
| 565 |
+
* @param string $hash
|
| 566 |
+
*
|
| 567 |
+
* @return string
|
| 568 |
+
*/
|
| 569 |
+
public function dbrains_url( $path, $args = array(), $hash = '' ) {
|
| 570 |
+
$args = wp_parse_args( $args, array(
|
| 571 |
+
'utm_medium' => 'insideplugin',
|
| 572 |
+
'utm_source' => $this->get_utm_source(),
|
| 573 |
+
) );
|
| 574 |
+
$args = array_map( 'urlencode', $args );
|
| 575 |
+
$url = trailingslashit( self::DBRAINS_URL ) . ltrim( $path, '/' );
|
| 576 |
+
$url = add_query_arg( $args, $url );
|
| 577 |
+
|
| 578 |
+
if ( $hash ) {
|
| 579 |
+
$url .= '#' . $hash;
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
return $url;
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
/**
|
| 586 |
+
* Get UTM source for plugin.
|
| 587 |
+
*
|
| 588 |
+
* @return string
|
| 589 |
+
*/
|
| 590 |
+
protected function get_utm_source() {
|
| 591 |
+
return 'AWS';
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
/**
|
| 595 |
+
* Get the My Account URL
|
| 596 |
+
*
|
| 597 |
+
* @param array $args
|
| 598 |
+
* @param string $hash
|
| 599 |
+
*
|
| 600 |
+
* @return string
|
| 601 |
+
*/
|
| 602 |
+
public function get_my_account_url( $args = array(), $hash = '' ) {
|
| 603 |
+
return $this->dbrains_url( '/my-account/', $args, $hash );
|
| 604 |
+
}
|
| 605 |
+
}
|
classes/as3cf-plugin-compatibility.php
CHANGED
|
@@ -38,6 +38,11 @@ class AS3CF_Plugin_Compatibility {
|
|
| 38 |
*/
|
| 39 |
protected $compatibility_addons;
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
/**
|
| 42 |
* @param Amazon_S3_And_CloudFront $as3cf
|
| 43 |
*/
|
|
@@ -96,11 +101,16 @@ class AS3CF_Plugin_Compatibility {
|
|
| 96 |
add_filter( 'wp_unique_filename', array( $this, 'customizer_crop_unique_filename' ), 10, 3 );
|
| 97 |
|
| 98 |
/*
|
| 99 |
-
* Regenerate Thumbnails
|
| 100 |
* https://wordpress.org/plugins/regenerate-thumbnails/
|
| 101 |
*/
|
| 102 |
add_filter( 'as3cf_get_attached_file', array( $this, 'regenerate_thumbnails_download_file' ), 10, 4 );
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
/*
|
| 105 |
* WP-CLI Compatibility
|
| 106 |
*/
|
|
@@ -141,6 +151,51 @@ class AS3CF_Plugin_Compatibility {
|
|
| 141 |
*/
|
| 142 |
public function enable_get_attached_file_copy_back_to_local() {
|
| 143 |
add_filter( 'as3cf_get_attached_file_copy_back_to_local', '__return_true' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
/**
|
|
@@ -863,4 +918,34 @@ class AS3CF_Plugin_Compatibility {
|
|
| 863 |
$this->as3cf->notices->remove_notice_by_id( $key_base . '-settings' );
|
| 864 |
}
|
| 865 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 866 |
}
|
| 38 |
*/
|
| 39 |
protected $compatibility_addons;
|
| 40 |
|
| 41 |
+
/**
|
| 42 |
+
* @var array
|
| 43 |
+
*/
|
| 44 |
+
private $removed_files = array();
|
| 45 |
+
|
| 46 |
/**
|
| 47 |
* @param Amazon_S3_And_CloudFront $as3cf
|
| 48 |
*/
|
| 101 |
add_filter( 'wp_unique_filename', array( $this, 'customizer_crop_unique_filename' ), 10, 3 );
|
| 102 |
|
| 103 |
/*
|
| 104 |
+
* Regenerate Thumbnails (before v3)
|
| 105 |
* https://wordpress.org/plugins/regenerate-thumbnails/
|
| 106 |
*/
|
| 107 |
add_filter( 'as3cf_get_attached_file', array( $this, 'regenerate_thumbnails_download_file' ), 10, 4 );
|
| 108 |
|
| 109 |
+
/**
|
| 110 |
+
* Regenerate Thumbnails v3+ and other REST-API using plugins that need a local file.
|
| 111 |
+
*/
|
| 112 |
+
add_filter( 'rest_dispatch_request', array( $this, 'rest_dispatch_request_copy_back_to_local' ), 10, 4 );
|
| 113 |
+
|
| 114 |
/*
|
| 115 |
* WP-CLI Compatibility
|
| 116 |
*/
|
| 151 |
*/
|
| 152 |
public function enable_get_attached_file_copy_back_to_local() {
|
| 153 |
add_filter( 'as3cf_get_attached_file_copy_back_to_local', '__return_true' );
|
| 154 |
+
|
| 155 |
+
// Monitor any files that are subsequently removed.
|
| 156 |
+
add_filter( 'as3cf_upload_attachment_local_files_to_remove', array(
|
| 157 |
+
$this,
|
| 158 |
+
'monitor_local_files_to_remove',
|
| 159 |
+
), 10, 3 );
|
| 160 |
+
|
| 161 |
+
// Prevent subsequent attempts to copy back after upload and remove.
|
| 162 |
+
add_filter( 'as3cf_get_attached_file_copy_back_to_local', array(
|
| 163 |
+
$this,
|
| 164 |
+
'prevent_copy_back_to_local_after_remove',
|
| 165 |
+
), 10, 4 );
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
/**
|
| 169 |
+
* Keeps track of local files that are removed after upload.
|
| 170 |
+
*
|
| 171 |
+
* @param array $files_to_remove
|
| 172 |
+
* @param integer $post_id
|
| 173 |
+
* @param string $file_path
|
| 174 |
+
*
|
| 175 |
+
* @return array
|
| 176 |
+
*/
|
| 177 |
+
public function monitor_local_files_to_remove( $files_to_remove, $post_id, $file_path ) {
|
| 178 |
+
$this->removed_files = array_merge( $this->removed_files, $files_to_remove );
|
| 179 |
+
|
| 180 |
+
return $files_to_remove;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
/**
|
| 184 |
+
* Prevent subsequent attempts to copy back after upload and remove.
|
| 185 |
+
*
|
| 186 |
+
* @param bool $copy_back_to_local
|
| 187 |
+
* @param string $file
|
| 188 |
+
* @param integer $attachment_id
|
| 189 |
+
* @param array $s3_object
|
| 190 |
+
*
|
| 191 |
+
* @return bool
|
| 192 |
+
*/
|
| 193 |
+
public function prevent_copy_back_to_local_after_remove( $copy_back_to_local, $file, $attachment_id, $s3_object ) {
|
| 194 |
+
if ( $copy_back_to_local && in_array( $file, $this->removed_files ) ) {
|
| 195 |
+
$copy_back_to_local = false;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
return $copy_back_to_local;
|
| 199 |
}
|
| 200 |
|
| 201 |
/**
|
| 918 |
$this->as3cf->notices->remove_notice_by_id( $key_base . '-settings' );
|
| 919 |
}
|
| 920 |
}
|
| 921 |
+
|
| 922 |
+
/**
|
| 923 |
+
* Filters the REST dispatch request to determine whether route needs compatibility actions.
|
| 924 |
+
*
|
| 925 |
+
* @param bool $dispatch_result Dispatch result, will be used if not empty.
|
| 926 |
+
* @param WP_REST_Request $request Request used to generate the response.
|
| 927 |
+
* @param string $route Route matched for the request.
|
| 928 |
+
* @param array $handler Route handler used for the request.
|
| 929 |
+
*
|
| 930 |
+
* @return bool
|
| 931 |
+
*/
|
| 932 |
+
public function rest_dispatch_request_copy_back_to_local( $dispatch_result, $request, $route, $handler ) {
|
| 933 |
+
$routes = array(
|
| 934 |
+
'/regenerate-thumbnails/v\d+/regenerate/',
|
| 935 |
+
);
|
| 936 |
+
|
| 937 |
+
$routes = apply_filters( 'as3cf_rest_api_enable_get_attached_file_copy_back_to_local', $routes );
|
| 938 |
+
$routes = is_array( $routes ) ? $routes : (array) $routes;
|
| 939 |
+
|
| 940 |
+
if ( ! empty( $routes ) ) {
|
| 941 |
+
foreach ( $routes as $match_route ) {
|
| 942 |
+
if ( preg_match( '@' . $match_route . '@i', $route ) ) {
|
| 943 |
+
$this->enable_get_attached_file_copy_back_to_local();
|
| 944 |
+
break;
|
| 945 |
+
}
|
| 946 |
+
}
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
return $dispatch_result;
|
| 950 |
+
}
|
| 951 |
}
|
classes/as3cf-stream-wrapper.php
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Register the 's3://' stream wrapper
|
| 7 |
*
|
| 8 |
-
* @param
|
| 9 |
* @param string $protocol
|
| 10 |
*/
|
| 11 |
-
public static function register(
|
| 12 |
if ( in_array( $protocol, stream_get_wrappers() ) ) {
|
| 13 |
stream_wrapper_unregister( $protocol );
|
| 14 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
|
| 4 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\StreamWrapper;
|
| 5 |
+
|
| 6 |
+
class AS3CF_Stream_Wrapper extends StreamWrapper {
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Register the 's3://' stream wrapper
|
| 10 |
*
|
| 11 |
+
* @param S3Client $client
|
| 12 |
* @param string $protocol
|
| 13 |
*/
|
| 14 |
+
public static function register( S3Client $client, $protocol = 's3' ) {
|
| 15 |
if ( in_array( $protocol, stream_get_wrappers() ) ) {
|
| 16 |
stream_wrapper_unregister( $protocol );
|
| 17 |
}
|
classes/as3cf-utils.php
CHANGED
|
@@ -34,77 +34,6 @@ if ( ! class_exists( 'AS3CF_Utils' ) ) {
|
|
| 34 |
return (int) get_post_field( 'ID', $post );
|
| 35 |
}
|
| 36 |
|
| 37 |
-
/**
|
| 38 |
-
* Checks if another version of WP Offload S3 (Lite) is active and deactivates it.
|
| 39 |
-
* To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
|
| 40 |
-
*
|
| 41 |
-
* @param string $plugin
|
| 42 |
-
*
|
| 43 |
-
* @return bool
|
| 44 |
-
*/
|
| 45 |
-
public static function deactivate_other_instances( $plugin ) {
|
| 46 |
-
if ( ! in_array( basename( $plugin ), array( 'amazon-s3-and-cloudfront-pro.php', 'wordpress-s3.php' ) ) ) {
|
| 47 |
-
return false;
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
$plugin_to_deactivate = 'wordpress-s3.php';
|
| 51 |
-
$deactivated_notice_id = '1';
|
| 52 |
-
$activated_plugin_min_version = '1.1';
|
| 53 |
-
$plugin_to_deactivate_min_version = '1.0';
|
| 54 |
-
if ( basename( $plugin ) === $plugin_to_deactivate ) {
|
| 55 |
-
$plugin_to_deactivate = 'amazon-s3-and-cloudfront-pro.php';
|
| 56 |
-
$deactivated_notice_id = '2';
|
| 57 |
-
$activated_plugin_min_version = '1.0';
|
| 58 |
-
$plugin_to_deactivate_min_version = '1.1';
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
$version = self::get_plugin_version_from_basename( $plugin );
|
| 62 |
-
|
| 63 |
-
if ( version_compare( $version, $activated_plugin_min_version, '<' ) ) {
|
| 64 |
-
return false;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
if ( is_multisite() ) {
|
| 68 |
-
$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
|
| 69 |
-
$active_plugins = array_keys( $active_plugins );
|
| 70 |
-
} else {
|
| 71 |
-
$active_plugins = (array) get_option( 'active_plugins', array() );
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
foreach ( $active_plugins as $basename ) {
|
| 75 |
-
if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
|
| 76 |
-
$version = self::get_plugin_version_from_basename( $basename );
|
| 77 |
-
|
| 78 |
-
if ( version_compare( $version, $plugin_to_deactivate_min_version, '<' ) ) {
|
| 79 |
-
return false;
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
set_transient( 'as3cf_deactivated_notice_id', $deactivated_notice_id, HOUR_IN_SECONDS );
|
| 83 |
-
deactivate_plugins( $basename );
|
| 84 |
-
|
| 85 |
-
return true;
|
| 86 |
-
}
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
return false;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
/**
|
| 93 |
-
* Get plugin data from basename
|
| 94 |
-
*
|
| 95 |
-
* @param string $basename
|
| 96 |
-
*
|
| 97 |
-
* @return string
|
| 98 |
-
*/
|
| 99 |
-
public static function get_plugin_version_from_basename( $basename ) {
|
| 100 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
| 101 |
-
|
| 102 |
-
$plugin_path = WP_PLUGIN_DIR . '/' . $basename;
|
| 103 |
-
$plugin_data = get_plugin_data( $plugin_path );
|
| 104 |
-
|
| 105 |
-
return $plugin_data['Version'];
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
/**
|
| 109 |
* Trailing slash prefix string ensuring no leading slashes.
|
| 110 |
*
|
|
@@ -432,5 +361,22 @@ if ( ! class_exists( 'AS3CF_Utils' ) ) {
|
|
| 432 |
|
| 433 |
call_user_func_array( 'deactivate_plugins', func_get_args() );
|
| 434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
}
|
| 436 |
}
|
| 34 |
return (int) get_post_field( 'ID', $post );
|
| 35 |
}
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
/**
|
| 38 |
* Trailing slash prefix string ensuring no leading slashes.
|
| 39 |
*
|
| 361 |
|
| 362 |
call_user_func_array( 'deactivate_plugins', func_get_args() );
|
| 363 |
}
|
| 364 |
+
|
| 365 |
+
/**
|
| 366 |
+
* Get the first defined constant from the given list of constant names.
|
| 367 |
+
*
|
| 368 |
+
* @param array $constants
|
| 369 |
+
*
|
| 370 |
+
* @return string|false string constant name if defined, otherwise false if none are defined
|
| 371 |
+
*/
|
| 372 |
+
public static function get_first_defined_constant( $constants ) {
|
| 373 |
+
foreach ( (array) $constants as $constant ) {
|
| 374 |
+
if ( defined( $constant ) ) {
|
| 375 |
+
return $constant;
|
| 376 |
+
}
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
return false;
|
| 380 |
+
}
|
| 381 |
}
|
| 382 |
}
|
classes/filters/as3cf-local-to-s3.php
CHANGED
|
@@ -61,7 +61,7 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
|
|
| 61 |
$cache = $this->get_post_cache( $post->ID );
|
| 62 |
$to_cache = array();
|
| 63 |
|
| 64 |
-
if ( 1 === count( $pages ) && ! empty( $pages[0] ) ) {
|
| 65 |
// Post already filtered and available on global $page array, continue
|
| 66 |
$post->post_content = $pages[0];
|
| 67 |
} else {
|
|
@@ -113,17 +113,42 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
|
|
| 113 |
* @return bool
|
| 114 |
*/
|
| 115 |
protected function url_needs_replacing( $url ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
$uploads = wp_upload_dir();
|
| 117 |
$base_url = $this->as3cf->maybe_fix_local_subsite_url( $uploads['baseurl'] );
|
| 118 |
$base_url = AS3CF_Utils::remove_scheme( $base_url );
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
}
|
| 124 |
|
| 125 |
-
|
| 126 |
-
return false;
|
| 127 |
}
|
| 128 |
|
| 129 |
/**
|
|
@@ -166,9 +191,7 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
|
|
| 166 |
return $this->query_cache[ $full_url ];
|
| 167 |
}
|
| 168 |
|
| 169 |
-
$
|
| 170 |
-
$base_url = AS3CF_Utils::remove_scheme( $upload_dir['baseurl'] );
|
| 171 |
-
$path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $base_url, '', $full_url ), '/' ) );
|
| 172 |
|
| 173 |
$sql = $wpdb->prepare( "
|
| 174 |
SELECT post_id FROM {$wpdb->postmeta}
|
|
@@ -210,9 +233,6 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
|
|
| 210 |
$urls = array( $urls );
|
| 211 |
}
|
| 212 |
|
| 213 |
-
$upload_dir = wp_upload_dir();
|
| 214 |
-
$base_url = AS3CF_Utils::remove_scheme( $upload_dir['baseurl'] );
|
| 215 |
-
|
| 216 |
$paths = array();
|
| 217 |
$full_urls = array();
|
| 218 |
|
|
@@ -226,7 +246,7 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
|
|
| 226 |
continue;
|
| 227 |
}
|
| 228 |
|
| 229 |
-
$path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $
|
| 230 |
|
| 231 |
$paths[ $path ] = $full_url;
|
| 232 |
$full_urls[ $full_url ] = $url;
|
|
@@ -312,4 +332,21 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
|
|
| 312 |
|
| 313 |
return $this->remove_aws_query_strings( $content, $base_url );
|
| 314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
}
|
| 61 |
$cache = $this->get_post_cache( $post->ID );
|
| 62 |
$to_cache = array();
|
| 63 |
|
| 64 |
+
if ( is_array( $pages ) && 1 === count( $pages ) && ! empty( $pages[0] ) ) {
|
| 65 |
// Post already filtered and available on global $page array, continue
|
| 66 |
$post->post_content = $pages[0];
|
| 67 |
} else {
|
| 113 |
* @return bool
|
| 114 |
*/
|
| 115 |
protected function url_needs_replacing( $url ) {
|
| 116 |
+
if ( str_replace( $this->get_bare_upload_base_urls(), '', $url ) === $url ) {
|
| 117 |
+
// Remote URL, no replacement needed
|
| 118 |
+
return false;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
// Local URL, perform replacement
|
| 122 |
+
return true;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Get an array of bare base_urls that can be used for uploaded items.
|
| 127 |
+
*
|
| 128 |
+
* @return array
|
| 129 |
+
*/
|
| 130 |
+
private function get_bare_upload_base_urls() {
|
| 131 |
+
$base_urls = array();
|
| 132 |
+
|
| 133 |
$uploads = wp_upload_dir();
|
| 134 |
$base_url = $this->as3cf->maybe_fix_local_subsite_url( $uploads['baseurl'] );
|
| 135 |
$base_url = AS3CF_Utils::remove_scheme( $base_url );
|
| 136 |
+
$domain = AS3CF_Utils::parse_url( $uploads['baseurl'], PHP_URL_HOST );
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
* Allow alteration of the local domains that can be matched on.
|
| 140 |
+
*
|
| 141 |
+
* @param array $domains
|
| 142 |
+
*/
|
| 143 |
+
$domains = apply_filters( 'as3cf_local_domains', (array) $domain );
|
| 144 |
+
|
| 145 |
+
if ( ! empty( $domains ) ) {
|
| 146 |
+
foreach ( array_unique( $domains ) as $match_domain ) {
|
| 147 |
+
$base_urls[] = substr_replace( $base_url, $match_domain, 2, strlen( $domain ) );
|
| 148 |
+
}
|
| 149 |
}
|
| 150 |
|
| 151 |
+
return $base_urls;
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
/**
|
| 191 |
return $this->query_cache[ $full_url ];
|
| 192 |
}
|
| 193 |
|
| 194 |
+
$path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
|
|
|
|
|
|
|
| 195 |
|
| 196 |
$sql = $wpdb->prepare( "
|
| 197 |
SELECT post_id FROM {$wpdb->postmeta}
|
| 233 |
$urls = array( $urls );
|
| 234 |
}
|
| 235 |
|
|
|
|
|
|
|
|
|
|
| 236 |
$paths = array();
|
| 237 |
$full_urls = array();
|
| 238 |
|
| 246 |
continue;
|
| 247 |
}
|
| 248 |
|
| 249 |
+
$path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
|
| 250 |
|
| 251 |
$paths[ $path ] = $full_url;
|
| 252 |
$full_urls[ $full_url ] = $url;
|
| 332 |
|
| 333 |
return $this->remove_aws_query_strings( $content, $base_url );
|
| 334 |
}
|
| 335 |
+
|
| 336 |
+
/**
|
| 337 |
+
* Each time a URL is replaced this function is called to allow for logging or further updates etc.
|
| 338 |
+
*
|
| 339 |
+
* @param string $find URL with no scheme.
|
| 340 |
+
* @param string $replace URL with no scheme.
|
| 341 |
+
* @param string $content
|
| 342 |
+
*
|
| 343 |
+
* @return string
|
| 344 |
+
*/
|
| 345 |
+
protected function url_replaced( $find, $replace, $content ) {
|
| 346 |
+
if ( (bool) $this->as3cf->get_setting( 'force-https' ) ) {
|
| 347 |
+
$content = str_replace( 'http:' . $replace, 'https:' . $replace, $content );
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
return $content;
|
| 351 |
+
}
|
| 352 |
}
|
classes/upgrades/upgrade.php
CHANGED
|
@@ -187,7 +187,7 @@ abstract class Upgrade {
|
|
| 187 |
return false;
|
| 188 |
}
|
| 189 |
|
| 190 |
-
if ( ! $this->as3cf->is_plugin_setup() ) {
|
| 191 |
return false;
|
| 192 |
}
|
| 193 |
|
| 187 |
return false;
|
| 188 |
}
|
| 189 |
|
| 190 |
+
if ( ! $this->as3cf->is_plugin_setup( true ) ) {
|
| 191 |
return false;
|
| 192 |
}
|
| 193 |
|
composer.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
| 2 |
"name": "deliciousbrains/wp-amazon-s3-and-cloudfront",
|
| 3 |
"type": "wordpress-plugin",
|
| 4 |
"homepage": "https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront",
|
| 5 |
-
"license": "
|
| 6 |
"description": "Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.",
|
| 7 |
"keywords": ["plugin","amazon-web-services","s3","cloudfront","cdn"],
|
| 8 |
"require": {
|
| 9 |
-
"composer/installers": "
|
| 10 |
}
|
| 11 |
}
|
| 2 |
"name": "deliciousbrains/wp-amazon-s3-and-cloudfront",
|
| 3 |
"type": "wordpress-plugin",
|
| 4 |
"homepage": "https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront",
|
| 5 |
+
"license": "GPL-3.0-only",
|
| 6 |
"description": "Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.",
|
| 7 |
"keywords": ["plugin","amazon-web-services","s3","cloudfront","cdn"],
|
| 8 |
"require": {
|
| 9 |
+
"composer/installers": "^1.0"
|
| 10 |
}
|
| 11 |
}
|
languages/amazon-s3-and-cloudfront-en.pot
CHANGED
|
@@ -8,7 +8,7 @@ msgid ""
|
|
| 8 |
msgstr ""
|
| 9 |
"Project-Id-Version: amazon-s3-and-cloudfront\n"
|
| 10 |
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
|
| 11 |
-
"POT-Creation-Date: 2018-
|
| 12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
| 13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -18,132 +18,175 @@ msgstr ""
|
|
| 18 |
"Content-Transfer-Encoding: 8bit\n"
|
| 19 |
|
| 20 |
#: classes/amazon-s3-and-cloudfront.php:123
|
| 21 |
-
msgid "Offload S3 Lite"
|
| 22 |
-
msgstr ""
|
| 23 |
-
|
| 24 |
#: classes/amazon-s3-and-cloudfront.php:124
|
| 25 |
-
msgid "S3
|
| 26 |
msgstr ""
|
| 27 |
|
| 28 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 29 |
-
#: view/bucket-setting.php:
|
|
|
|
|
|
|
| 30 |
msgid "defined in wp-config.php"
|
| 31 |
msgstr ""
|
| 32 |
|
| 33 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
#, php-format
|
| 36 |
msgid "File %s does not exist"
|
| 37 |
msgstr ""
|
| 38 |
|
| 39 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 40 |
#, php-format
|
| 41 |
msgid "Mime type %s is not allowed"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 45 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 46 |
#, php-format
|
| 47 |
msgid "Error uploading %s to S3: %s"
|
| 48 |
msgstr ""
|
| 49 |
|
| 50 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 51 |
msgid "Cheatin’ eh?"
|
| 52 |
msgstr ""
|
| 53 |
|
| 54 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 55 |
msgid "You do not have sufficient permissions to access this page."
|
| 56 |
msgstr ""
|
| 57 |
|
| 58 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 59 |
msgid "No bucket name provided."
|
| 60 |
msgstr ""
|
| 61 |
|
| 62 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 63 |
msgid "Error Getting Bucket Region"
|
| 64 |
msgstr ""
|
| 65 |
|
| 66 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 67 |
#, php-format
|
| 68 |
msgid "There was an error attempting to get the region of the bucket %s: %s"
|
| 69 |
msgstr ""
|
| 70 |
|
| 71 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 72 |
msgid ""
|
| 73 |
"This is a test file to check if the user has write permission to S3. Delete "
|
| 74 |
"me if found."
|
| 75 |
msgstr ""
|
| 76 |
|
| 77 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 78 |
#, php-format
|
| 79 |
msgid ""
|
| 80 |
"There was an error attempting to check the permissions of the bucket %s: %s"
|
| 81 |
msgstr ""
|
| 82 |
|
| 83 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 84 |
msgid "Error creating bucket"
|
| 85 |
msgstr ""
|
| 86 |
|
| 87 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 88 |
msgid "Bucket name too short."
|
| 89 |
msgstr ""
|
| 90 |
|
| 91 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 92 |
msgid "Bucket name too long."
|
| 93 |
msgstr ""
|
| 94 |
|
| 95 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 96 |
msgid ""
|
| 97 |
"Invalid character. Bucket names can contain lowercase letters, numbers, "
|
| 98 |
"periods and hyphens."
|
| 99 |
msgstr ""
|
| 100 |
|
| 101 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 102 |
msgid "Error saving bucket"
|
| 103 |
msgstr ""
|
| 104 |
|
| 105 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 106 |
msgid "Error fetching buckets"
|
| 107 |
msgstr ""
|
| 108 |
|
| 109 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 110 |
msgid "Error getting URL preview: "
|
| 111 |
msgstr ""
|
| 112 |
|
| 113 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 114 |
msgid "The changes you made will be lost if you navigate away from this page"
|
| 115 |
msgstr ""
|
| 116 |
|
| 117 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 118 |
msgid "Getting diagnostic info..."
|
| 119 |
msgstr ""
|
| 120 |
|
| 121 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 122 |
msgid "Error getting diagnostic info: "
|
| 123 |
msgstr ""
|
| 124 |
|
| 125 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
msgid "Cheatin' eh?"
|
| 127 |
msgstr ""
|
| 128 |
|
| 129 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 130 |
msgctxt "Show the media library tab"
|
| 131 |
msgid "Media Library"
|
| 132 |
msgstr ""
|
| 133 |
|
| 134 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
msgctxt "Show the support tab"
|
| 136 |
msgid "Support"
|
| 137 |
msgstr ""
|
| 138 |
|
| 139 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 140 |
#, php-format
|
| 141 |
msgid ""
|
| 142 |
"<strong>WP Offload S3</strong> — The file %s has been given %s "
|
| 143 |
"permissions on Amazon S3."
|
| 144 |
msgstr ""
|
| 145 |
|
| 146 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 147 |
msgid ""
|
| 148 |
"<strong>WP Offload S3 Requirement Missing</strong> — Looks like you "
|
| 149 |
"don't have an image manipulation library installed on this server and "
|
|
@@ -151,11 +194,17 @@ msgid ""
|
|
| 151 |
"Please setup GD or ImageMagick."
|
| 152 |
msgstr ""
|
| 153 |
|
| 154 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
msgid "Quick Start Guide"
|
| 156 |
msgstr ""
|
| 157 |
|
| 158 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 159 |
#, php-format
|
| 160 |
msgid ""
|
| 161 |
"Looks like we don't have write access to this bucket. It's likely that the "
|
|
@@ -164,7 +213,7 @@ msgid ""
|
|
| 164 |
"correctly."
|
| 165 |
msgstr ""
|
| 166 |
|
| 167 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 168 |
#, php-format
|
| 169 |
msgid ""
|
| 170 |
"Looks like we don't have access to the buckets. It's likely that the user "
|
|
@@ -172,39 +221,39 @@ msgid ""
|
|
| 172 |
"Please see our %s for instructions on setting up permissions correctly."
|
| 173 |
msgstr ""
|
| 174 |
|
| 175 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 176 |
msgid "WP Offload S3 Activation"
|
| 177 |
msgstr ""
|
| 178 |
|
| 179 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 180 |
msgid ""
|
| 181 |
"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
|
| 182 |
"automatically deactivated WP Offload S3 Lite."
|
| 183 |
msgstr ""
|
| 184 |
|
| 185 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 186 |
msgid "WP Offload S3 Lite Activation"
|
| 187 |
msgstr ""
|
| 188 |
|
| 189 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 190 |
msgid ""
|
| 191 |
"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
|
| 192 |
"automatically deactivated WP Offload S3."
|
| 193 |
msgstr ""
|
| 194 |
|
| 195 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 196 |
-
msgid "More info"
|
| 197 |
msgstr ""
|
| 198 |
|
| 199 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 200 |
msgid "this doc"
|
| 201 |
msgstr ""
|
| 202 |
|
| 203 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 204 |
msgid "WP Offload S3 Feature Removed"
|
| 205 |
msgstr ""
|
| 206 |
|
| 207 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 208 |
#, php-format
|
| 209 |
msgid ""
|
| 210 |
"You had the \"Always non-SSL\" option selected in your settings, but we've "
|
|
@@ -215,35 +264,177 @@ msgid ""
|
|
| 215 |
"to the old behavior."
|
| 216 |
msgstr ""
|
| 217 |
|
| 218 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 219 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 220 |
msgid "Amazon S3"
|
| 221 |
msgstr ""
|
| 222 |
|
| 223 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 224 |
msgctxt "Amazon S3 bucket"
|
| 225 |
msgid "Bucket"
|
| 226 |
msgstr ""
|
| 227 |
|
| 228 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 229 |
msgctxt "Path to file on Amazon S3"
|
| 230 |
msgid "Path"
|
| 231 |
msgstr ""
|
| 232 |
|
| 233 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 234 |
msgctxt "Location of Amazon S3 bucket"
|
| 235 |
msgid "Region"
|
| 236 |
msgstr ""
|
| 237 |
|
| 238 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 239 |
msgctxt "Access control list of the file on Amazon S3"
|
| 240 |
msgid "Access"
|
| 241 |
msgstr ""
|
| 242 |
|
| 243 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
| 244 |
msgid "URL"
|
| 245 |
msgstr ""
|
| 246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
#: classes/as3cf-notices.php:431
|
| 248 |
msgid "Error dismissing notice."
|
| 249 |
msgstr ""
|
|
@@ -252,19 +443,23 @@ msgstr ""
|
|
| 252 |
msgid "Invalid notice ID."
|
| 253 |
msgstr ""
|
| 254 |
|
| 255 |
-
#: classes/as3cf-plugin-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
#, php-format
|
| 257 |
msgid "The local directory %s does not exist and could not be created."
|
| 258 |
msgstr ""
|
| 259 |
|
| 260 |
-
#: classes/as3cf-plugin-compatibility.php:
|
| 261 |
-
#: classes/as3cf-plugin-compatibility.php:
|
| 262 |
#: classes/upgrades/upgrade-meta-wp-error.php:81
|
| 263 |
#, php-format
|
| 264 |
msgid "There was an error attempting to download the file %s from S3: %s"
|
| 265 |
msgstr ""
|
| 266 |
|
| 267 |
-
#: classes/as3cf-plugin-compatibility.php:
|
| 268 |
#, php-format
|
| 269 |
msgid ""
|
| 270 |
"<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP "
|
|
@@ -381,81 +576,28 @@ msgstr ""
|
|
| 381 |
msgid "Every %d Minutes"
|
| 382 |
msgstr ""
|
| 383 |
|
| 384 |
-
#:
|
| 385 |
-
msgid "
|
| 386 |
-
msgstr ""
|
| 387 |
-
|
| 388 |
-
#: classes/wp-aws-compatibility-check.php:324
|
| 389 |
-
#, php-format
|
| 390 |
-
msgid "You can %s the %s plugin to get rid of this notice."
|
| 391 |
-
msgstr ""
|
| 392 |
-
|
| 393 |
-
#: classes/wp-aws-compatibility-check.php:327
|
| 394 |
-
#, php-format
|
| 395 |
-
msgid "%s has been disabled as it requires the %s plugin."
|
| 396 |
-
msgstr ""
|
| 397 |
-
|
| 398 |
-
#: classes/wp-aws-compatibility-check.php:331
|
| 399 |
-
msgid "which is currently disabled."
|
| 400 |
-
msgstr ""
|
| 401 |
-
|
| 402 |
-
#: classes/wp-aws-compatibility-check.php:333
|
| 403 |
-
msgid "It appears to be installed already."
|
| 404 |
msgstr ""
|
| 405 |
|
| 406 |
-
#:
|
| 407 |
-
msgctxt "
|
| 408 |
-
msgid "
|
| 409 |
-
msgstr ""
|
| 410 |
-
|
| 411 |
-
#: classes/wp-aws-compatibility-check.php:342
|
| 412 |
-
#, php-format
|
| 413 |
-
msgid "<a href=\"%s\">Install</a> and activate it."
|
| 414 |
msgstr ""
|
| 415 |
|
| 416 |
-
#:
|
| 417 |
-
|
| 418 |
-
msgid ""
|
| 419 |
-
"%s has been disabled as it requires version %s or later of the %s plugin."
|
| 420 |
msgstr ""
|
| 421 |
|
| 422 |
-
#:
|
| 423 |
-
|
| 424 |
-
msgid "
|
| 425 |
msgstr ""
|
| 426 |
|
| 427 |
-
#:
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
msgid "A valid license for %s is required to update."
|
| 431 |
-
msgstr ""
|
| 432 |
-
|
| 433 |
-
#: classes/wp-aws-compatibility-check.php:371
|
| 434 |
-
msgid "Update to the latest version"
|
| 435 |
-
msgstr ""
|
| 436 |
-
|
| 437 |
-
#: classes/wp-aws-compatibility-check.php:383
|
| 438 |
-
#, php-format
|
| 439 |
-
msgid ""
|
| 440 |
-
"%1$s has been disabled because it is not a supported addon of the %2$s "
|
| 441 |
-
"plugin."
|
| 442 |
-
msgstr ""
|
| 443 |
-
|
| 444 |
-
#: classes/wp-aws-compatibility-check.php:392
|
| 445 |
-
#, php-format
|
| 446 |
-
msgid ""
|
| 447 |
-
"%1$s has been disabled because it will not work with the version of the %2$s "
|
| 448 |
-
"plugin installed. %1$s %3$s or later is required."
|
| 449 |
-
msgstr ""
|
| 450 |
-
|
| 451 |
-
#: classes/wp-aws-compatibility-check.php:395
|
| 452 |
-
#, php-format
|
| 453 |
-
msgid "Update %s to the latest version"
|
| 454 |
-
msgstr ""
|
| 455 |
-
|
| 456 |
-
#: classes/wp-aws-compatibility-check.php:464
|
| 457 |
-
#, php-format
|
| 458 |
-
msgid "The %s plugin has been deactivated."
|
| 459 |
msgstr ""
|
| 460 |
|
| 461 |
#: view/attachment-metabox.php:14
|
|
@@ -546,19 +688,26 @@ msgstr ""
|
|
| 546 |
msgid "Create New Bucket"
|
| 547 |
msgstr ""
|
| 548 |
|
| 549 |
-
#: view/bucket-setting.php:
|
| 550 |
msgid "Bucket"
|
| 551 |
msgstr ""
|
| 552 |
|
| 553 |
-
#: view/bucket-setting.php:
|
| 554 |
msgid "View in S3 console"
|
| 555 |
msgstr ""
|
| 556 |
|
| 557 |
-
#: view/bucket-setting.php:
|
| 558 |
msgid "Change"
|
| 559 |
msgstr ""
|
| 560 |
|
| 561 |
-
#: view/bucket-setting.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 562 |
msgid ""
|
| 563 |
"<strong>Bucket Select Disabled</strong> — Bucket selection has been "
|
| 564 |
"disabled while files are copied between buckets."
|
|
@@ -620,105 +769,181 @@ msgstr ""
|
|
| 620 |
msgid "Show"
|
| 621 |
msgstr ""
|
| 622 |
|
| 623 |
-
#: view/settings.php:10
|
| 624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
msgstr ""
|
| 626 |
|
| 627 |
-
#: view/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 628 |
msgid "Enable/Disable the Plugin"
|
| 629 |
msgstr ""
|
| 630 |
|
| 631 |
-
#: view/settings.php:56
|
| 632 |
msgid "Copy Files to S3"
|
| 633 |
msgstr ""
|
| 634 |
|
| 635 |
-
#: view/settings.php:58
|
| 636 |
msgid ""
|
| 637 |
"When a file is uploaded to the Media Library, copy it to S3. Existing files "
|
| 638 |
"are <em>not</em> copied to S3."
|
| 639 |
msgstr ""
|
| 640 |
|
| 641 |
-
#: view/settings.php:71
|
| 642 |
msgid "Rewrite File URLs"
|
| 643 |
msgstr ""
|
| 644 |
|
| 645 |
-
#: view/settings.php:73
|
| 646 |
msgid ""
|
| 647 |
"For Media Library files that have been copied to S3, rewrite the URLs so "
|
| 648 |
"that they are served from S3/CloudFront instead of your server."
|
| 649 |
msgstr ""
|
| 650 |
|
| 651 |
-
#: view/settings.php:80
|
| 652 |
msgid "Configure File URLs"
|
| 653 |
msgstr ""
|
| 654 |
|
| 655 |
-
#: view/settings.php:101
|
| 656 |
msgid "Path"
|
| 657 |
msgstr ""
|
| 658 |
|
| 659 |
-
#: view/settings.php:103
|
| 660 |
msgid "By default the path is the same as your local WordPress files."
|
| 661 |
msgstr ""
|
| 662 |
|
| 663 |
-
#: view/settings.php:120
|
| 664 |
msgid "Year/Month"
|
| 665 |
msgstr ""
|
| 666 |
|
| 667 |
-
#: view/settings.php:122
|
| 668 |
msgid "Add the Year/Month in the URL."
|
| 669 |
msgstr ""
|
| 670 |
|
| 671 |
-
#: view/settings.php:135
|
| 672 |
msgid "Force HTTPS"
|
| 673 |
msgstr ""
|
| 674 |
|
| 675 |
-
#: view/settings.php:137
|
| 676 |
msgid ""
|
| 677 |
"By default we use HTTPS when the request is HTTPS and regular HTTP when the "
|
| 678 |
"request is HTTP, but you may want to force the use of HTTPS always, "
|
| 679 |
"regardless of the request."
|
| 680 |
msgstr ""
|
| 681 |
|
| 682 |
-
#: view/settings.php:144
|
| 683 |
msgid "Advanced Options"
|
| 684 |
msgstr ""
|
| 685 |
|
| 686 |
-
#: view/settings.php:153
|
| 687 |
msgid "Remove Files From Server"
|
| 688 |
msgstr ""
|
| 689 |
|
| 690 |
-
#: view/settings.php:154
|
| 691 |
msgid "Once a file has been copied to S3, remove it from the local server."
|
| 692 |
msgstr ""
|
| 693 |
|
| 694 |
-
#: view/settings.php:158
|
| 695 |
msgid ""
|
| 696 |
"<strong>Broken URLs</strong> — There will be broken URLs for files "
|
| 697 |
"that don't exist locally. You can fix this by enabling <strong>Rewrite File "
|
| 698 |
"URLs</strong> to use the S3 URLs."
|
| 699 |
msgstr ""
|
| 700 |
|
| 701 |
-
#: view/settings.php:169
|
| 702 |
#, php-format
|
| 703 |
msgid ""
|
| 704 |
"<strong>Warning</strong> — Some plugins depend on the file being "
|
| 705 |
"present on the local server and may not work when the file is removed. %s"
|
| 706 |
msgstr ""
|
| 707 |
|
| 708 |
-
#: view/settings.php:187
|
| 709 |
msgid "Object Versioning"
|
| 710 |
msgstr ""
|
| 711 |
|
| 712 |
-
#: view/settings.php:189
|
| 713 |
msgid ""
|
| 714 |
"Append a timestamp to the S3 file path. Recommended when using CloudFront so "
|
| 715 |
"you don't have to worry about cache invalidation."
|
| 716 |
msgstr ""
|
| 717 |
|
| 718 |
-
#: view/settings.php:196
|
|
|
|
| 719 |
msgid "Save Changes"
|
| 720 |
msgstr ""
|
| 721 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 722 |
#: view/sidebar.php:13
|
| 723 |
msgid "Upload existing Media Library to S3"
|
| 724 |
msgstr ""
|
| 8 |
msgstr ""
|
| 9 |
"Project-Id-Version: amazon-s3-and-cloudfront\n"
|
| 10 |
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
|
| 11 |
+
"POT-Creation-Date: 2018-02-20 14:59+0000\n"
|
| 12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
| 13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 18 |
"Content-Transfer-Encoding: 8bit\n"
|
| 19 |
|
| 20 |
#: classes/amazon-s3-and-cloudfront.php:123
|
|
|
|
|
|
|
|
|
|
| 21 |
#: classes/amazon-s3-and-cloudfront.php:124
|
| 22 |
+
msgid "Offload S3"
|
| 23 |
msgstr ""
|
| 24 |
|
| 25 |
+
#: classes/amazon-s3-and-cloudfront.php:254
|
| 26 |
+
#: view/bucket-setting.php:17
|
| 27 |
+
#: view/settings/settings.php:76
|
| 28 |
+
#: view/settings/settings.php:93
|
| 29 |
msgid "defined in wp-config.php"
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
+
#: classes/amazon-s3-and-cloudfront.php:781
|
| 33 |
+
msgid "Access keys updated successfully."
|
| 34 |
+
msgstr ""
|
| 35 |
+
|
| 36 |
+
#: classes/amazon-s3-and-cloudfront.php:786
|
| 37 |
+
msgid ""
|
| 38 |
+
"All access key constants must be removed before keys can be set in the "
|
| 39 |
+
"database."
|
| 40 |
+
msgstr ""
|
| 41 |
+
|
| 42 |
+
#: classes/amazon-s3-and-cloudfront.php:794
|
| 43 |
+
msgid "The Access Key ID must be set."
|
| 44 |
+
msgstr ""
|
| 45 |
+
|
| 46 |
+
#: classes/amazon-s3-and-cloudfront.php:799
|
| 47 |
+
#: classes/amazon-s3-and-cloudfront.php:2871
|
| 48 |
+
#: view/settings/settings.php:88
|
| 49 |
+
msgctxt "placeholder for hidden access key, 39 char max"
|
| 50 |
+
msgid "-- not shown --"
|
| 51 |
+
msgstr ""
|
| 52 |
+
|
| 53 |
+
#: classes/amazon-s3-and-cloudfront.php:803
|
| 54 |
+
msgid "The Secret Access Key must be at least 40 characters long."
|
| 55 |
+
msgstr ""
|
| 56 |
+
|
| 57 |
+
#: classes/amazon-s3-and-cloudfront.php:824
|
| 58 |
+
msgid "Access keys removed from the database successfully."
|
| 59 |
+
msgstr ""
|
| 60 |
+
|
| 61 |
+
#: classes/amazon-s3-and-cloudfront.php:1012
|
| 62 |
+
#: classes/amazon-s3-and-cloudfront.php:1170
|
| 63 |
#, php-format
|
| 64 |
msgid "File %s does not exist"
|
| 65 |
msgstr ""
|
| 66 |
|
| 67 |
+
#: classes/amazon-s3-and-cloudfront.php:1023
|
| 68 |
#, php-format
|
| 69 |
msgid "Mime type %s is not allowed"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
+
#: classes/amazon-s3-and-cloudfront.php:1106
|
| 73 |
+
#: classes/amazon-s3-and-cloudfront.php:1178
|
| 74 |
#, php-format
|
| 75 |
msgid "Error uploading %s to S3: %s"
|
| 76 |
msgstr ""
|
| 77 |
|
| 78 |
+
#: classes/amazon-s3-and-cloudfront.php:2324
|
| 79 |
msgid "Cheatin’ eh?"
|
| 80 |
msgstr ""
|
| 81 |
|
| 82 |
+
#: classes/amazon-s3-and-cloudfront.php:2328
|
| 83 |
msgid "You do not have sufficient permissions to access this page."
|
| 84 |
msgstr ""
|
| 85 |
|
| 86 |
+
#: classes/amazon-s3-and-cloudfront.php:2334
|
| 87 |
msgid "No bucket name provided."
|
| 88 |
msgstr ""
|
| 89 |
|
| 90 |
+
#: classes/amazon-s3-and-cloudfront.php:2637
|
| 91 |
msgid "Error Getting Bucket Region"
|
| 92 |
msgstr ""
|
| 93 |
|
| 94 |
+
#: classes/amazon-s3-and-cloudfront.php:2638
|
| 95 |
#, php-format
|
| 96 |
msgid "There was an error attempting to get the region of the bucket %s: %s"
|
| 97 |
msgstr ""
|
| 98 |
|
| 99 |
+
#: classes/amazon-s3-and-cloudfront.php:2776
|
| 100 |
msgid ""
|
| 101 |
"This is a test file to check if the user has write permission to S3. Delete "
|
| 102 |
"me if found."
|
| 103 |
msgstr ""
|
| 104 |
|
| 105 |
+
#: classes/amazon-s3-and-cloudfront.php:2795
|
| 106 |
#, php-format
|
| 107 |
msgid ""
|
| 108 |
"There was an error attempting to check the permissions of the bucket %s: %s"
|
| 109 |
msgstr ""
|
| 110 |
|
| 111 |
+
#: classes/amazon-s3-and-cloudfront.php:2861
|
| 112 |
msgid "Error creating bucket"
|
| 113 |
msgstr ""
|
| 114 |
|
| 115 |
+
#: classes/amazon-s3-and-cloudfront.php:2862
|
| 116 |
msgid "Bucket name too short."
|
| 117 |
msgstr ""
|
| 118 |
|
| 119 |
+
#: classes/amazon-s3-and-cloudfront.php:2863
|
| 120 |
msgid "Bucket name too long."
|
| 121 |
msgstr ""
|
| 122 |
|
| 123 |
+
#: classes/amazon-s3-and-cloudfront.php:2864
|
| 124 |
msgid ""
|
| 125 |
"Invalid character. Bucket names can contain lowercase letters, numbers, "
|
| 126 |
"periods and hyphens."
|
| 127 |
msgstr ""
|
| 128 |
|
| 129 |
+
#: classes/amazon-s3-and-cloudfront.php:2865
|
| 130 |
msgid "Error saving bucket"
|
| 131 |
msgstr ""
|
| 132 |
|
| 133 |
+
#: classes/amazon-s3-and-cloudfront.php:2866
|
| 134 |
msgid "Error fetching buckets"
|
| 135 |
msgstr ""
|
| 136 |
|
| 137 |
+
#: classes/amazon-s3-and-cloudfront.php:2867
|
| 138 |
msgid "Error getting URL preview: "
|
| 139 |
msgstr ""
|
| 140 |
|
| 141 |
+
#: classes/amazon-s3-and-cloudfront.php:2868
|
| 142 |
msgid "The changes you made will be lost if you navigate away from this page"
|
| 143 |
msgstr ""
|
| 144 |
|
| 145 |
+
#: classes/amazon-s3-and-cloudfront.php:2869
|
| 146 |
msgid "Getting diagnostic info..."
|
| 147 |
msgstr ""
|
| 148 |
|
| 149 |
+
#: classes/amazon-s3-and-cloudfront.php:2870
|
| 150 |
msgid "Error getting diagnostic info: "
|
| 151 |
msgstr ""
|
| 152 |
|
| 153 |
+
#: classes/amazon-s3-and-cloudfront.php:2873
|
| 154 |
+
#: classes/amazon-s3-and-cloudfront.php:4583
|
| 155 |
+
msgid "Settings saved."
|
| 156 |
+
msgstr ""
|
| 157 |
+
|
| 158 |
+
#: classes/amazon-s3-and-cloudfront.php:2943
|
| 159 |
msgid "Cheatin' eh?"
|
| 160 |
msgstr ""
|
| 161 |
|
| 162 |
+
#: classes/amazon-s3-and-cloudfront.php:2992
|
| 163 |
msgctxt "Show the media library tab"
|
| 164 |
msgid "Media Library"
|
| 165 |
msgstr ""
|
| 166 |
|
| 167 |
+
#: classes/amazon-s3-and-cloudfront.php:2993
|
| 168 |
+
msgctxt "Show the addons tab"
|
| 169 |
+
msgid "Addons"
|
| 170 |
+
msgstr ""
|
| 171 |
+
|
| 172 |
+
#: classes/amazon-s3-and-cloudfront.php:2994
|
| 173 |
+
msgctxt "Show the settings tab"
|
| 174 |
+
msgid "Settings"
|
| 175 |
+
msgstr ""
|
| 176 |
+
|
| 177 |
+
#: classes/amazon-s3-and-cloudfront.php:2995
|
| 178 |
msgctxt "Show the support tab"
|
| 179 |
msgid "Support"
|
| 180 |
msgstr ""
|
| 181 |
|
| 182 |
+
#: classes/amazon-s3-and-cloudfront.php:3230
|
| 183 |
#, php-format
|
| 184 |
msgid ""
|
| 185 |
"<strong>WP Offload S3</strong> — The file %s has been given %s "
|
| 186 |
"permissions on Amazon S3."
|
| 187 |
msgstr ""
|
| 188 |
|
| 189 |
+
#: classes/amazon-s3-and-cloudfront.php:3249
|
| 190 |
msgid ""
|
| 191 |
"<strong>WP Offload S3 Requirement Missing</strong> — Looks like you "
|
| 192 |
"don't have an image manipulation library installed on this server and "
|
| 194 |
"Please setup GD or ImageMagick."
|
| 195 |
msgstr ""
|
| 196 |
|
| 197 |
+
#: classes/amazon-s3-and-cloudfront.php:3863
|
| 198 |
+
#, php-format
|
| 199 |
+
msgid ""
|
| 200 |
+
"<a href=\"%s\">Define your AWS keys</a> to enable write access to the bucket"
|
| 201 |
+
msgstr ""
|
| 202 |
+
|
| 203 |
+
#: classes/amazon-s3-and-cloudfront.php:3870
|
| 204 |
msgid "Quick Start Guide"
|
| 205 |
msgstr ""
|
| 206 |
|
| 207 |
+
#: classes/amazon-s3-and-cloudfront.php:3872
|
| 208 |
#, php-format
|
| 209 |
msgid ""
|
| 210 |
"Looks like we don't have write access to this bucket. It's likely that the "
|
| 213 |
"correctly."
|
| 214 |
msgstr ""
|
| 215 |
|
| 216 |
+
#: classes/amazon-s3-and-cloudfront.php:3874
|
| 217 |
#, php-format
|
| 218 |
msgid ""
|
| 219 |
"Looks like we don't have access to the buckets. It's likely that the user "
|
| 221 |
"Please see our %s for instructions on setting up permissions correctly."
|
| 222 |
msgstr ""
|
| 223 |
|
| 224 |
+
#: classes/amazon-s3-and-cloudfront.php:4024
|
| 225 |
msgid "WP Offload S3 Activation"
|
| 226 |
msgstr ""
|
| 227 |
|
| 228 |
+
#: classes/amazon-s3-and-cloudfront.php:4025
|
| 229 |
msgid ""
|
| 230 |
"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
|
| 231 |
"automatically deactivated WP Offload S3 Lite."
|
| 232 |
msgstr ""
|
| 233 |
|
| 234 |
+
#: classes/amazon-s3-and-cloudfront.php:4027
|
| 235 |
msgid "WP Offload S3 Lite Activation"
|
| 236 |
msgstr ""
|
| 237 |
|
| 238 |
+
#: classes/amazon-s3-and-cloudfront.php:4028
|
| 239 |
msgid ""
|
| 240 |
"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
|
| 241 |
"automatically deactivated WP Offload S3."
|
| 242 |
msgstr ""
|
| 243 |
|
| 244 |
+
#: classes/amazon-s3-and-cloudfront.php:4080
|
| 245 |
+
msgid "More info »"
|
| 246 |
msgstr ""
|
| 247 |
|
| 248 |
+
#: classes/amazon-s3-and-cloudfront.php:4175
|
| 249 |
msgid "this doc"
|
| 250 |
msgstr ""
|
| 251 |
|
| 252 |
+
#: classes/amazon-s3-and-cloudfront.php:4177
|
| 253 |
msgid "WP Offload S3 Feature Removed"
|
| 254 |
msgstr ""
|
| 255 |
|
| 256 |
+
#: classes/amazon-s3-and-cloudfront.php:4178
|
| 257 |
#, php-format
|
| 258 |
msgid ""
|
| 259 |
"You had the \"Always non-SSL\" option selected in your settings, but we've "
|
| 264 |
"to the old behavior."
|
| 265 |
msgstr ""
|
| 266 |
|
| 267 |
+
#: classes/amazon-s3-and-cloudfront.php:4208
|
| 268 |
+
#: classes/amazon-s3-and-cloudfront.php:4317
|
| 269 |
msgid "Amazon S3"
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
+
#: classes/amazon-s3-and-cloudfront.php:4318
|
| 273 |
msgctxt "Amazon S3 bucket"
|
| 274 |
msgid "Bucket"
|
| 275 |
msgstr ""
|
| 276 |
|
| 277 |
+
#: classes/amazon-s3-and-cloudfront.php:4319
|
| 278 |
msgctxt "Path to file on Amazon S3"
|
| 279 |
msgid "Path"
|
| 280 |
msgstr ""
|
| 281 |
|
| 282 |
+
#: classes/amazon-s3-and-cloudfront.php:4320
|
| 283 |
msgctxt "Location of Amazon S3 bucket"
|
| 284 |
msgid "Region"
|
| 285 |
msgstr ""
|
| 286 |
|
| 287 |
+
#: classes/amazon-s3-and-cloudfront.php:4321
|
| 288 |
msgctxt "Access control list of the file on Amazon S3"
|
| 289 |
msgid "Access"
|
| 290 |
msgstr ""
|
| 291 |
|
| 292 |
+
#: classes/amazon-s3-and-cloudfront.php:4322
|
| 293 |
msgid "URL"
|
| 294 |
msgstr ""
|
| 295 |
|
| 296 |
+
#: classes/amazon-s3-and-cloudfront.php:4546
|
| 297 |
+
msgid "Assets Pull"
|
| 298 |
+
msgstr ""
|
| 299 |
+
|
| 300 |
+
#: classes/amazon-s3-and-cloudfront.php:4547
|
| 301 |
+
msgid ""
|
| 302 |
+
"An addon for WP Offload S3 to serve your site's JS, CSS, and other enqueued "
|
| 303 |
+
"assets from Amazon CloudFront or another CDN."
|
| 304 |
+
msgstr ""
|
| 305 |
+
|
| 306 |
+
#: classes/amazon-s3-and-cloudfront.php:4551
|
| 307 |
+
msgid "Feature"
|
| 308 |
+
msgstr ""
|
| 309 |
+
|
| 310 |
+
#: classes/amazon-s3-and-cloudfront.php:4597
|
| 311 |
+
#, php-format
|
| 312 |
+
msgid ""
|
| 313 |
+
"<strong>Amazon Web Services Plugin No Longer Required</strong> — As of "
|
| 314 |
+
"version 1.6 of WP Offload S3, the <a href=\"%1$s\">Amazon Web Services</a> "
|
| 315 |
+
"plugin is no longer required. We have removed the dependency by bundling a "
|
| 316 |
+
"small portion of the AWS SDK into WP Offload S3. As long as none of your "
|
| 317 |
+
"other active plugins or themes depend on the Amazon Web Services plugin, it "
|
| 318 |
+
"should be safe to deactivate and delete it. %2$s"
|
| 319 |
+
msgstr ""
|
| 320 |
+
|
| 321 |
+
#: classes/amazon-s3-and-cloudfront.php:4629
|
| 322 |
+
#, php-format
|
| 323 |
+
msgid ""
|
| 324 |
+
"<strong>WP Offload S3 Settings Moved</strong> — You now define your "
|
| 325 |
+
"AWS keys for WP Offload S3 in the new <a href=\"%1$s\">Settings tab</a>. "
|
| 326 |
+
"Saving settings in the form below will have no effect on WP Offload S3. %2$s"
|
| 327 |
+
msgstr ""
|
| 328 |
+
|
| 329 |
+
#: classes/amazon-web-services.php:148
|
| 330 |
+
#, php-format
|
| 331 |
+
msgid ""
|
| 332 |
+
"You must first <a href=\"%s\">set your AWS access keys</a> to use this addon."
|
| 333 |
+
msgstr ""
|
| 334 |
+
|
| 335 |
+
#: classes/as3cf-compatibility-check.php:317
|
| 336 |
+
msgid "deactivate"
|
| 337 |
+
msgstr ""
|
| 338 |
+
|
| 339 |
+
#: classes/as3cf-compatibility-check.php:318
|
| 340 |
+
#, php-format
|
| 341 |
+
msgid "You can %s the %s plugin to get rid of this notice."
|
| 342 |
+
msgstr ""
|
| 343 |
+
|
| 344 |
+
#: classes/as3cf-compatibility-check.php:336
|
| 345 |
+
#, php-format
|
| 346 |
+
msgid "%s has been disabled as it requires the %s plugin."
|
| 347 |
+
msgstr ""
|
| 348 |
+
|
| 349 |
+
#: classes/as3cf-compatibility-check.php:340
|
| 350 |
+
msgid "which is currently disabled."
|
| 351 |
+
msgstr ""
|
| 352 |
+
|
| 353 |
+
#: classes/as3cf-compatibility-check.php:342
|
| 354 |
+
msgid "It appears to be installed already."
|
| 355 |
+
msgstr ""
|
| 356 |
+
|
| 357 |
+
#: classes/as3cf-compatibility-check.php:344
|
| 358 |
+
msgctxt "Activate plugin"
|
| 359 |
+
msgid "Activate it now."
|
| 360 |
+
msgstr ""
|
| 361 |
+
|
| 362 |
+
#: classes/as3cf-compatibility-check.php:351
|
| 363 |
+
#, php-format
|
| 364 |
+
msgid "<a href=\"%s\">Install</a> and activate it."
|
| 365 |
+
msgstr ""
|
| 366 |
+
|
| 367 |
+
#: classes/as3cf-compatibility-check.php:362
|
| 368 |
+
#, php-format
|
| 369 |
+
msgid ""
|
| 370 |
+
"%s has been disabled as it requires version %s or later of the %s plugin."
|
| 371 |
+
msgstr ""
|
| 372 |
+
|
| 373 |
+
#: classes/as3cf-compatibility-check.php:365
|
| 374 |
+
#, php-format
|
| 375 |
+
msgid "You currently have version %s installed."
|
| 376 |
+
msgstr ""
|
| 377 |
+
|
| 378 |
+
#: classes/as3cf-compatibility-check.php:372
|
| 379 |
+
#: classes/as3cf-compatibility-check.php:410
|
| 380 |
+
#, php-format
|
| 381 |
+
msgid "A valid license for %s is required to update."
|
| 382 |
+
msgstr ""
|
| 383 |
+
|
| 384 |
+
#: classes/as3cf-compatibility-check.php:381
|
| 385 |
+
msgid "Update to the latest version"
|
| 386 |
+
msgstr ""
|
| 387 |
+
|
| 388 |
+
#: classes/as3cf-compatibility-check.php:392
|
| 389 |
+
#, php-format
|
| 390 |
+
msgid ""
|
| 391 |
+
"%1$s has been disabled because it is not a supported addon of the %2$s "
|
| 392 |
+
"plugin."
|
| 393 |
+
msgstr ""
|
| 394 |
+
|
| 395 |
+
#: classes/as3cf-compatibility-check.php:401
|
| 396 |
+
#, php-format
|
| 397 |
+
msgid ""
|
| 398 |
+
"%1$s has been disabled because it will not work with the version of the %2$s "
|
| 399 |
+
"plugin installed. %1$s %3$s or later is required."
|
| 400 |
+
msgstr ""
|
| 401 |
+
|
| 402 |
+
#: classes/as3cf-compatibility-check.php:404
|
| 403 |
+
#, php-format
|
| 404 |
+
msgid "Update %s to the latest version"
|
| 405 |
+
msgstr ""
|
| 406 |
+
|
| 407 |
+
#: classes/as3cf-compatibility-check.php:473
|
| 408 |
+
#, php-format
|
| 409 |
+
msgid "The %s plugin has been deactivated."
|
| 410 |
+
msgstr ""
|
| 411 |
+
|
| 412 |
+
#: classes/as3cf-compatibility-check.php:619
|
| 413 |
+
msgid "a PHP version less than 5.3.3"
|
| 414 |
+
msgstr ""
|
| 415 |
+
|
| 416 |
+
#: classes/as3cf-compatibility-check.php:623
|
| 417 |
+
msgid "no PHP cURL library activated"
|
| 418 |
+
msgstr ""
|
| 419 |
+
|
| 420 |
+
#: classes/as3cf-compatibility-check.php:629
|
| 421 |
+
msgid "a cURL version less than 7.16.2"
|
| 422 |
+
msgstr ""
|
| 423 |
+
|
| 424 |
+
#: classes/as3cf-compatibility-check.php:644
|
| 425 |
+
msgid "cURL compiled without"
|
| 426 |
+
msgstr ""
|
| 427 |
+
|
| 428 |
+
#: classes/as3cf-compatibility-check.php:649
|
| 429 |
+
msgid "the function curl_multi_exec disabled"
|
| 430 |
+
msgstr ""
|
| 431 |
+
|
| 432 |
+
#: classes/as3cf-compatibility-check.php:667
|
| 433 |
+
msgid ""
|
| 434 |
+
"The official Amazon Web Services SDK requires PHP 5.3.3+ and cURL "
|
| 435 |
+
"7.16.2+ compiled with OpenSSL and zlib. Your server currently has"
|
| 436 |
+
msgstr ""
|
| 437 |
+
|
| 438 |
#: classes/as3cf-notices.php:431
|
| 439 |
msgid "Error dismissing notice."
|
| 440 |
msgstr ""
|
| 443 |
msgid "Invalid notice ID."
|
| 444 |
msgstr ""
|
| 445 |
|
| 446 |
+
#: classes/as3cf-plugin-base.php:461
|
| 447 |
+
msgid "Settings"
|
| 448 |
+
msgstr ""
|
| 449 |
+
|
| 450 |
+
#: classes/as3cf-plugin-compatibility.php:570
|
| 451 |
#, php-format
|
| 452 |
msgid "The local directory %s does not exist and could not be created."
|
| 453 |
msgstr ""
|
| 454 |
|
| 455 |
+
#: classes/as3cf-plugin-compatibility.php:571
|
| 456 |
+
#: classes/as3cf-plugin-compatibility.php:583
|
| 457 |
#: classes/upgrades/upgrade-meta-wp-error.php:81
|
| 458 |
#, php-format
|
| 459 |
msgid "There was an error attempting to download the file %s from S3: %s"
|
| 460 |
msgstr ""
|
| 461 |
|
| 462 |
+
#: classes/as3cf-plugin-compatibility.php:891
|
| 463 |
#, php-format
|
| 464 |
msgid ""
|
| 465 |
"<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP "
|
| 576 |
msgid "Every %d Minutes"
|
| 577 |
msgstr ""
|
| 578 |
|
| 579 |
+
#: view/addon.php:11
|
| 580 |
+
msgid "More Details »"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
msgstr ""
|
| 582 |
|
| 583 |
+
#: view/addon.php:40
|
| 584 |
+
msgctxt "Plugin already installed and activated"
|
| 585 |
+
msgid "Installed & Activated"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
msgstr ""
|
| 587 |
|
| 588 |
+
#: view/addon.php:42
|
| 589 |
+
msgctxt "Plugin already installed"
|
| 590 |
+
msgid "Installed"
|
|
|
|
| 591 |
msgstr ""
|
| 592 |
|
| 593 |
+
#: view/addon.php:43
|
| 594 |
+
msgctxt "Activate plugin now"
|
| 595 |
+
msgid "Activate Now"
|
| 596 |
msgstr ""
|
| 597 |
|
| 598 |
+
#: view/addon.php:45
|
| 599 |
+
msgctxt "Install plugin now"
|
| 600 |
+
msgid "Install Now"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
msgstr ""
|
| 602 |
|
| 603 |
#: view/attachment-metabox.php:14
|
| 688 |
msgid "Create New Bucket"
|
| 689 |
msgstr ""
|
| 690 |
|
| 691 |
+
#: view/bucket-setting.php:8
|
| 692 |
msgid "Bucket"
|
| 693 |
msgstr ""
|
| 694 |
|
| 695 |
+
#: view/bucket-setting.php:13
|
| 696 |
msgid "View in S3 console"
|
| 697 |
msgstr ""
|
| 698 |
|
| 699 |
+
#: view/bucket-setting.php:19
|
| 700 |
msgid "Change"
|
| 701 |
msgstr ""
|
| 702 |
|
| 703 |
+
#: view/bucket-setting.php:37
|
| 704 |
+
#, php-format
|
| 705 |
+
msgid ""
|
| 706 |
+
"<strong>Bucket Select Disabled</strong> — <a href=\"%s\">Define your "
|
| 707 |
+
"AWS keys</a> to configure the bucket"
|
| 708 |
+
msgstr ""
|
| 709 |
+
|
| 710 |
+
#: view/bucket-setting.php:46
|
| 711 |
msgid ""
|
| 712 |
"<strong>Bucket Select Disabled</strong> — Bucket selection has been "
|
| 713 |
"disabled while files are copied between buckets."
|
| 769 |
msgid "Show"
|
| 770 |
msgstr ""
|
| 771 |
|
| 772 |
+
#: view/settings/addons.php:10
|
| 773 |
+
#, php-format
|
| 774 |
+
msgid ""
|
| 775 |
+
"<strong>Get Addons</strong> — The following addons are available with a WP "
|
| 776 |
+
"Offload S3 Gold license or better.<br>Visit <a href=\"%s\">deliciousbrains."
|
| 777 |
+
"com</a> to purchase in just a few clicks."
|
| 778 |
msgstr ""
|
| 779 |
|
| 780 |
+
#: view/settings/media.php:13
|
| 781 |
+
#, php-format
|
| 782 |
+
msgid "<a href=\"%s\">Define your AWS keys</a> to configure WP Offload S3"
|
| 783 |
+
msgstr ""
|
| 784 |
+
|
| 785 |
+
#: view/settings/media.php:47
|
| 786 |
msgid "Enable/Disable the Plugin"
|
| 787 |
msgstr ""
|
| 788 |
|
| 789 |
+
#: view/settings/media.php:56
|
| 790 |
msgid "Copy Files to S3"
|
| 791 |
msgstr ""
|
| 792 |
|
| 793 |
+
#: view/settings/media.php:58
|
| 794 |
msgid ""
|
| 795 |
"When a file is uploaded to the Media Library, copy it to S3. Existing files "
|
| 796 |
"are <em>not</em> copied to S3."
|
| 797 |
msgstr ""
|
| 798 |
|
| 799 |
+
#: view/settings/media.php:71
|
| 800 |
msgid "Rewrite File URLs"
|
| 801 |
msgstr ""
|
| 802 |
|
| 803 |
+
#: view/settings/media.php:73
|
| 804 |
msgid ""
|
| 805 |
"For Media Library files that have been copied to S3, rewrite the URLs so "
|
| 806 |
"that they are served from S3/CloudFront instead of your server."
|
| 807 |
msgstr ""
|
| 808 |
|
| 809 |
+
#: view/settings/media.php:80
|
| 810 |
msgid "Configure File URLs"
|
| 811 |
msgstr ""
|
| 812 |
|
| 813 |
+
#: view/settings/media.php:101
|
| 814 |
msgid "Path"
|
| 815 |
msgstr ""
|
| 816 |
|
| 817 |
+
#: view/settings/media.php:103
|
| 818 |
msgid "By default the path is the same as your local WordPress files."
|
| 819 |
msgstr ""
|
| 820 |
|
| 821 |
+
#: view/settings/media.php:120
|
| 822 |
msgid "Year/Month"
|
| 823 |
msgstr ""
|
| 824 |
|
| 825 |
+
#: view/settings/media.php:122
|
| 826 |
msgid "Add the Year/Month in the URL."
|
| 827 |
msgstr ""
|
| 828 |
|
| 829 |
+
#: view/settings/media.php:135
|
| 830 |
msgid "Force HTTPS"
|
| 831 |
msgstr ""
|
| 832 |
|
| 833 |
+
#: view/settings/media.php:137
|
| 834 |
msgid ""
|
| 835 |
"By default we use HTTPS when the request is HTTPS and regular HTTP when the "
|
| 836 |
"request is HTTP, but you may want to force the use of HTTPS always, "
|
| 837 |
"regardless of the request."
|
| 838 |
msgstr ""
|
| 839 |
|
| 840 |
+
#: view/settings/media.php:144
|
| 841 |
msgid "Advanced Options"
|
| 842 |
msgstr ""
|
| 843 |
|
| 844 |
+
#: view/settings/media.php:153
|
| 845 |
msgid "Remove Files From Server"
|
| 846 |
msgstr ""
|
| 847 |
|
| 848 |
+
#: view/settings/media.php:154
|
| 849 |
msgid "Once a file has been copied to S3, remove it from the local server."
|
| 850 |
msgstr ""
|
| 851 |
|
| 852 |
+
#: view/settings/media.php:158
|
| 853 |
msgid ""
|
| 854 |
"<strong>Broken URLs</strong> — There will be broken URLs for files "
|
| 855 |
"that don't exist locally. You can fix this by enabling <strong>Rewrite File "
|
| 856 |
"URLs</strong> to use the S3 URLs."
|
| 857 |
msgstr ""
|
| 858 |
|
| 859 |
+
#: view/settings/media.php:169
|
| 860 |
#, php-format
|
| 861 |
msgid ""
|
| 862 |
"<strong>Warning</strong> — Some plugins depend on the file being "
|
| 863 |
"present on the local server and may not work when the file is removed. %s"
|
| 864 |
msgstr ""
|
| 865 |
|
| 866 |
+
#: view/settings/media.php:187
|
| 867 |
msgid "Object Versioning"
|
| 868 |
msgstr ""
|
| 869 |
|
| 870 |
+
#: view/settings/media.php:189
|
| 871 |
msgid ""
|
| 872 |
"Append a timestamp to the S3 file path. Recommended when using CloudFront so "
|
| 873 |
"you don't have to worry about cache invalidation."
|
| 874 |
msgstr ""
|
| 875 |
|
| 876 |
+
#: view/settings/media.php:196
|
| 877 |
+
#: view/settings/settings.php:112
|
| 878 |
msgid "Save Changes"
|
| 879 |
msgstr ""
|
| 880 |
|
| 881 |
+
#: view/settings/settings.php:19
|
| 882 |
+
msgid "AWS Access Keys"
|
| 883 |
+
msgstr ""
|
| 884 |
+
|
| 885 |
+
#: view/settings/settings.php:23
|
| 886 |
+
msgid "You have enabled the use of IAM roles for Amazon EC2 instances."
|
| 887 |
+
msgstr ""
|
| 888 |
+
|
| 889 |
+
#: view/settings/settings.php:30
|
| 890 |
+
msgid ""
|
| 891 |
+
"Please check your wp-config.php file as it looks like one of your defines is "
|
| 892 |
+
"missing or incorrect."
|
| 893 |
+
msgstr ""
|
| 894 |
+
|
| 895 |
+
#: view/settings/settings.php:36
|
| 896 |
+
#, php-format
|
| 897 |
+
msgid ""
|
| 898 |
+
"You’ve already defined your AWS access keys in your wp-config.php. If "
|
| 899 |
+
"you’d prefer to manage them here and store them in the database (<a "
|
| 900 |
+
"href=\"%s\">not recommended</a>), simply remove the lines from your wp-"
|
| 901 |
+
"config."
|
| 902 |
+
msgstr ""
|
| 903 |
+
|
| 904 |
+
#: view/settings/settings.php:42
|
| 905 |
+
msgid ""
|
| 906 |
+
"We recommend defining your Access Keys in wp-config.php so long as you "
|
| 907 |
+
"don’t commit it to source control (you shouldn’t be). Simply "
|
| 908 |
+
"copy the following snippet and replace the stars with the keys."
|
| 909 |
+
msgstr ""
|
| 910 |
+
|
| 911 |
+
#: view/settings/settings.php:52
|
| 912 |
+
#, php-format
|
| 913 |
+
msgid ""
|
| 914 |
+
"You’re storing your Access Keys in the database (<a href=\"%s\">not "
|
| 915 |
+
"recommended</a>).</a>"
|
| 916 |
+
msgstr ""
|
| 917 |
+
|
| 918 |
+
#: view/settings/settings.php:56
|
| 919 |
+
msgid ""
|
| 920 |
+
"If you’d rather store your Access Keys in the database, <a href=\"#\" "
|
| 921 |
+
"data-as3cf-toggle-access-keys-form>click here to reveal a form.</a>"
|
| 922 |
+
msgstr ""
|
| 923 |
+
|
| 924 |
+
#: view/settings/settings.php:66
|
| 925 |
+
msgid "Access Key ID"
|
| 926 |
+
msgstr ""
|
| 927 |
+
|
| 928 |
+
#: view/settings/settings.php:83
|
| 929 |
+
msgid "Secret Access Key"
|
| 930 |
+
msgstr ""
|
| 931 |
+
|
| 932 |
+
#: view/settings/settings.php:103
|
| 933 |
+
msgid "This will store your AWS access keys in the database (not recommended)."
|
| 934 |
+
msgstr ""
|
| 935 |
+
|
| 936 |
+
#: view/settings/settings.php:115
|
| 937 |
+
msgid "Remove Keys"
|
| 938 |
+
msgstr ""
|
| 939 |
+
|
| 940 |
+
#: view/settings/settings.php:127
|
| 941 |
+
#, php-format
|
| 942 |
+
msgid ""
|
| 943 |
+
"Need help getting your Access Keys? <a href=\"%s\">Check out the Quick Start "
|
| 944 |
+
"Guide →</a>"
|
| 945 |
+
msgstr ""
|
| 946 |
+
|
| 947 |
#: view/sidebar.php:13
|
| 948 |
msgid "Upload existing Media Library to S3"
|
| 949 |
msgstr ""
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: bradt, deliciousbrains
|
|
| 3 |
Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
|
| 4 |
Requires at least: 4.6
|
| 5 |
Tested up to: 4.9
|
| 6 |
-
Stable tag: 1.
|
| 7 |
License: GPLv3
|
| 8 |
|
| 9 |
Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
|
|
@@ -65,6 +65,23 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
|
|
| 65 |
|
| 66 |
== Changelog ==
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
= WP Offload S3 Lite 1.2.1 - 2017-11-20 =
|
| 69 |
* New: Compatibility with HTML Widget
|
| 70 |
* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
|
| 3 |
Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
|
| 4 |
Requires at least: 4.6
|
| 5 |
Tested up to: 4.9
|
| 6 |
+
Stable tag: 1.3
|
| 7 |
License: GPLv3
|
| 8 |
|
| 9 |
Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
|
| 65 |
|
| 66 |
== Changelog ==
|
| 67 |
|
| 68 |
+
= WP Offload S3 Lite 1.3 - 2018-02-20 =
|
| 69 |
+
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
|
| 70 |
+
* New: [Amazon Web Services plugin](https://wordpress.org/plugins/amazon-web-services/) is no longer required to run WP Offload S3 Lite
|
| 71 |
+
* New: Added [`as3cf_local_domains`](https://deliciousbrains.com/wp-offload-s3/doc/filtering-urls-for-multiple-domains/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) filter for when site content is updated through multiple domains
|
| 72 |
+
* Improvement: AWS keys can be set in new "Settings" tab if not defined in wp-config.php
|
| 73 |
+
* Improvement: Minor tweaks to settings page UI including right aligning tabs and consistent title across Lite and Pro plugins
|
| 74 |
+
* Improvement: cURL version, theme version and parent theme information added to diagnostics
|
| 75 |
+
* Bug fix: Incompatible with plugins that include AWS PHP SDK v3
|
| 76 |
+
* Bug fix: Regenerate Thumbnails v3.0+ does not work with Remove Files From Server option
|
| 77 |
+
* Bug fix: "Warning: count(): Parameter must be an array or an object that implements Countable" error with PHP 7.2
|
| 78 |
+
* Bug fix: Force HTTPS not being applied to non-srcset S3 URLs in pages served over HTTP
|
| 79 |
+
* Bug fix: Content URLs not filtered to S3 URLs if AWS keys not set
|
| 80 |
+
* Bug fix: URL preview can be coerced to display invalid URL
|
| 81 |
+
* Bug fix: Changes to upload made via `as3cf_object_meta` filter are not reflected in amazonS3_info records
|
| 82 |
+
* Bug fix: Settings link not showing in network admin plugins page
|
| 83 |
+
* Bug fix: License in composer.json fails Packagist validation
|
| 84 |
+
|
| 85 |
= WP Offload S3 Lite 1.2.1 - 2017-11-20 =
|
| 86 |
* New: Compatibility with HTML Widget
|
| 87 |
* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
|
vendor/Aws2/aws/aws-sdk-php/LICENSE.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
|
| 4 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 5 |
+
|
| 6 |
+
## 1. Definitions.
|
| 7 |
+
|
| 8 |
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1
|
| 9 |
+
through 9 of this document.
|
| 10 |
+
|
| 11 |
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the
|
| 12 |
+
License.
|
| 13 |
+
|
| 14 |
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled
|
| 15 |
+
by, or are under common control with that entity. For the purposes of this definition, "control" means
|
| 16 |
+
(i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract
|
| 17 |
+
or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
|
| 18 |
+
ownership of such entity.
|
| 19 |
+
|
| 20 |
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
| 21 |
+
|
| 22 |
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software
|
| 23 |
+
source code, documentation source, and configuration files.
|
| 24 |
+
|
| 25 |
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form,
|
| 26 |
+
including but not limited to compiled object code, generated documentation, and conversions to other media
|
| 27 |
+
types.
|
| 28 |
+
|
| 29 |
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License,
|
| 30 |
+
as indicated by a copyright notice that is included in or attached to the work (an example is provided in the
|
| 31 |
+
Appendix below).
|
| 32 |
+
|
| 33 |
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from)
|
| 34 |
+
the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent,
|
| 35 |
+
as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not
|
| 36 |
+
include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work
|
| 37 |
+
and Derivative Works thereof.
|
| 38 |
+
|
| 39 |
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any
|
| 40 |
+
modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
|
| 41 |
+
Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
|
| 42 |
+
submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
|
| 43 |
+
electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
|
| 44 |
+
limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
|
| 45 |
+
that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
|
| 46 |
+
excluding communication that is conspicuously marked or otherwise designated in writing by the copyright
|
| 47 |
+
owner as "Not a Contribution."
|
| 48 |
+
|
| 49 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been
|
| 50 |
+
received by Licensor and subsequently incorporated within the Work.
|
| 51 |
+
|
| 52 |
+
## 2. Grant of Copyright License.
|
| 53 |
+
|
| 54 |
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
|
| 55 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
|
| 56 |
+
Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such
|
| 57 |
+
Derivative Works in Source or Object form.
|
| 58 |
+
|
| 59 |
+
## 3. Grant of Patent License.
|
| 60 |
+
|
| 61 |
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
|
| 62 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent
|
| 63 |
+
license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such
|
| 64 |
+
license applies only to those patent claims licensable by such Contributor that are necessarily infringed by
|
| 65 |
+
their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such
|
| 66 |
+
Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim
|
| 67 |
+
or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work
|
| 68 |
+
constitutes direct or contributory patent infringement, then any patent licenses granted to You under this
|
| 69 |
+
License for that Work shall terminate as of the date such litigation is filed.
|
| 70 |
+
|
| 71 |
+
## 4. Redistribution.
|
| 72 |
+
|
| 73 |
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without
|
| 74 |
+
modifications, and in Source or Object form, provided that You meet the following conditions:
|
| 75 |
+
|
| 76 |
+
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
| 77 |
+
|
| 78 |
+
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
| 79 |
+
|
| 80 |
+
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
|
| 81 |
+
trademark, and attribution notices from the Source form of the Work, excluding those notices that do
|
| 82 |
+
not pertain to any part of the Derivative Works; and
|
| 83 |
+
|
| 84 |
+
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
|
| 85 |
+
You distribute must include a readable copy of the attribution notices contained within such NOTICE
|
| 86 |
+
file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one
|
| 87 |
+
of the following places: within a NOTICE text file distributed as part of the Derivative Works; within
|
| 88 |
+
the Source form or documentation, if provided along with the Derivative Works; or, within a display
|
| 89 |
+
generated by the Derivative Works, if and wherever such third-party notices normally appear. The
|
| 90 |
+
contents of the NOTICE file are for informational purposes only and do not modify the License. You may
|
| 91 |
+
add Your own attribution notices within Derivative Works that You distribute, alongside or as an
|
| 92 |
+
addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be
|
| 93 |
+
construed as modifying the License.
|
| 94 |
+
|
| 95 |
+
You may add Your own copyright statement to Your modifications and may provide additional or different license
|
| 96 |
+
terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative
|
| 97 |
+
Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the
|
| 98 |
+
conditions stated in this License.
|
| 99 |
+
|
| 100 |
+
## 5. Submission of Contributions.
|
| 101 |
+
|
| 102 |
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by
|
| 103 |
+
You to the Licensor shall be under the terms and conditions of this License, without any additional terms or
|
| 104 |
+
conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate
|
| 105 |
+
license agreement you may have executed with Licensor regarding such Contributions.
|
| 106 |
+
|
| 107 |
+
## 6. Trademarks.
|
| 108 |
+
|
| 109 |
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of
|
| 110 |
+
the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
|
| 111 |
+
reproducing the content of the NOTICE file.
|
| 112 |
+
|
| 113 |
+
## 7. Disclaimer of Warranty.
|
| 114 |
+
|
| 115 |
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor
|
| 116 |
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
| 117 |
+
or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
| 118 |
+
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 119 |
+
appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of
|
| 120 |
+
permissions under this License.
|
| 121 |
+
|
| 122 |
+
## 8. Limitation of Liability.
|
| 123 |
+
|
| 124 |
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless
|
| 125 |
+
required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any
|
| 126 |
+
Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential
|
| 127 |
+
damages of any character arising as a result of this License or out of the use or inability to use the Work
|
| 128 |
+
(including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
| 129 |
+
any and all other commercial damages or losses), even if such Contributor has been advised of the possibility
|
| 130 |
+
of such damages.
|
| 131 |
+
|
| 132 |
+
## 9. Accepting Warranty or Additional Liability.
|
| 133 |
+
|
| 134 |
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for,
|
| 135 |
+
acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this
|
| 136 |
+
License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole
|
| 137 |
+
responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold
|
| 138 |
+
each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason
|
| 139 |
+
of your accepting any such warranty or additional liability.
|
| 140 |
+
|
| 141 |
+
END OF TERMS AND CONDITIONS
|
vendor/Aws2/aws/aws-sdk-php/NOTICE.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AWS SDK for PHP
|
| 2 |
+
|
| 3 |
+
<http://aws.amazon.com/php>
|
| 4 |
+
|
| 5 |
+
Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 6 |
+
|
| 7 |
+
Licensed under the Apache License, Version 2.0 (the "License").
|
| 8 |
+
You may not use this file except in compliance with the License.
|
| 9 |
+
A copy of the License is located at
|
| 10 |
+
|
| 11 |
+
<http://aws.amazon.com/apache2.0>
|
| 12 |
+
|
| 13 |
+
or in the "license" file accompanying this file. This file is distributed
|
| 14 |
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 15 |
+
express or implied. See the License for the specific language governing
|
| 16 |
+
permissions and limitations under the License.
|
| 17 |
+
|
| 18 |
+
# Guzzle
|
| 19 |
+
|
| 20 |
+
<https://github.com/guzzle/guzzle>
|
| 21 |
+
|
| 22 |
+
Copyright (c) 2011 Michael Dowling, https://github.com/mtdowling
|
| 23 |
+
|
| 24 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 25 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 26 |
+
in the Software without restriction, including without limitation the rights
|
| 27 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 28 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 29 |
+
furnished to do so, subject to the following conditions:
|
| 30 |
+
|
| 31 |
+
The above copyright notice and this permission notice shall be included in
|
| 32 |
+
all copies or substantial portions of the Software.
|
| 33 |
+
|
| 34 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 35 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 36 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 37 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 38 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 39 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 40 |
+
THE SOFTWARE.
|
| 41 |
+
|
| 42 |
+
# Symfony
|
| 43 |
+
|
| 44 |
+
<https://github.com/symfony/symfony>
|
| 45 |
+
|
| 46 |
+
Copyright (c) 2004-2012 Fabien Potencier
|
| 47 |
+
|
| 48 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 49 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 50 |
+
in the Software without restriction, including without limitation the rights
|
| 51 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 52 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
| 53 |
+
to do so, subject to the following conditions:
|
| 54 |
+
|
| 55 |
+
The above copyright notice and this permission notice shall be included in all
|
| 56 |
+
copies or substantial portions of the Software.
|
| 57 |
+
|
| 58 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 59 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 60 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 61 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 62 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 63 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 64 |
+
THE SOFTWARE.
|
| 65 |
+
|
| 66 |
+
# Doctrine Common
|
| 67 |
+
|
| 68 |
+
<https://github.com/doctrine/common>
|
| 69 |
+
|
| 70 |
+
Copyright (c) 2006-2012 Doctrine Project
|
| 71 |
+
|
| 72 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
| 73 |
+
this software and associated documentation files (the "Software"), to deal in
|
| 74 |
+
the Software without restriction, including without limitation the rights to
|
| 75 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
| 76 |
+
of the Software, and to permit persons to whom the Software is furnished to do
|
| 77 |
+
so, subject to the following conditions:
|
| 78 |
+
|
| 79 |
+
The above copyright notice and this permission notice shall be included in all
|
| 80 |
+
copies or substantial portions of the Software.
|
| 81 |
+
|
| 82 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 83 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 84 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 85 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 86 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 87 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 88 |
+
SOFTWARE.
|
| 89 |
+
|
| 90 |
+
# Monolog
|
| 91 |
+
|
| 92 |
+
<https://github.com/Seldaek/monolog>
|
| 93 |
+
|
| 94 |
+
Copyright (c) Jordi Boggiano
|
| 95 |
+
|
| 96 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 97 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 98 |
+
in the Software without restriction, including without limitation the rights
|
| 99 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 100 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
| 101 |
+
to do so, subject to the following conditions:
|
| 102 |
+
|
| 103 |
+
The above copyright notice and this permission notice shall be included in all
|
| 104 |
+
copies or substantial portions of the Software.
|
| 105 |
+
|
| 106 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 107 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 108 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 109 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 110 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 111 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 112 |
+
THE SOFTWARE.
|
vendor/Aws2/aws/aws-sdk-php/composer.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "aws\/aws-sdk-php",
|
| 3 |
+
"homepage": "http:\/\/aws.amazon.com\/sdkforphp",
|
| 4 |
+
"description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
|
| 5 |
+
"keywords": [
|
| 6 |
+
"aws",
|
| 7 |
+
"amazon",
|
| 8 |
+
"sdk",
|
| 9 |
+
"s3",
|
| 10 |
+
"ec2",
|
| 11 |
+
"dynamodb",
|
| 12 |
+
"cloud",
|
| 13 |
+
"glacier"
|
| 14 |
+
],
|
| 15 |
+
"type": "library",
|
| 16 |
+
"license": "Apache-2.0",
|
| 17 |
+
"authors": [
|
| 18 |
+
{
|
| 19 |
+
"name": "Amazon Web Services",
|
| 20 |
+
"homepage": "http:\/\/aws.amazon.com"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"support": {
|
| 24 |
+
"forum": "https:\/\/forums.aws.amazon.com\/forum.jspa?forumID=80",
|
| 25 |
+
"issues": "https:\/\/github.com\/aws\/aws-sdk-php\/issues"
|
| 26 |
+
},
|
| 27 |
+
"require": {
|
| 28 |
+
"php": ">=5.3.3",
|
| 29 |
+
"guzzle\/guzzle": "~3.7"
|
| 30 |
+
},
|
| 31 |
+
"suggest": {
|
| 32 |
+
"doctrine\/cache": "Adds support for caching of credentials and responses",
|
| 33 |
+
"ext-apc": "Allows service description opcode caching, request and response caching, and credentials caching",
|
| 34 |
+
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
|
| 35 |
+
"monolog\/monolog": "Adds support for logging HTTP requests and responses",
|
| 36 |
+
"symfony\/yaml": "Eases the ability to write manifests for creating jobs in AWS Import\/Export"
|
| 37 |
+
},
|
| 38 |
+
"require-dev": {
|
| 39 |
+
"ext-openssl": "*",
|
| 40 |
+
"doctrine\/cache": "~1.0",
|
| 41 |
+
"monolog\/monolog": "~1.4",
|
| 42 |
+
"phpunit\/phpunit": "~4.0",
|
| 43 |
+
"phpunit\/phpunit-mock-objects": "2.3.1",
|
| 44 |
+
"symfony\/yaml": "~2.1"
|
| 45 |
+
},
|
| 46 |
+
"autoload": {
|
| 47 |
+
"psr-0": {
|
| 48 |
+
"Aws": "src\/"
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Aws.php
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilder;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilderLoader;
|
| 22 |
+
/**
|
| 23 |
+
* Base class for interacting with web service clients
|
| 24 |
+
*/
|
| 25 |
+
class Aws extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilder
|
| 26 |
+
{
|
| 27 |
+
/**
|
| 28 |
+
* @var string Current version of the SDK
|
| 29 |
+
*/
|
| 30 |
+
const VERSION = '2.8.31';
|
| 31 |
+
/**
|
| 32 |
+
* Create a new service locator for the AWS SDK
|
| 33 |
+
*
|
| 34 |
+
* You can configure the service locator is four different ways:
|
| 35 |
+
*
|
| 36 |
+
* 1. Use the default configuration file shipped with the SDK that wires class names with service short names and
|
| 37 |
+
* specify global parameters to add to every definition (e.g. key, secret, credentials, etc)
|
| 38 |
+
*
|
| 39 |
+
* 2. Use a custom configuration file that extends the default config and supplies credentials for each service.
|
| 40 |
+
*
|
| 41 |
+
* 3. Use a custom config file that wires services to custom short names for services.
|
| 42 |
+
*
|
| 43 |
+
* 4. If you are on Amazon EC2, you can use the default configuration file and not provide any credentials so that
|
| 44 |
+
* you are using InstanceProfile credentials.
|
| 45 |
+
*
|
| 46 |
+
* @param array|string $config The full path to a .php or .js|.json file, or an associative array of data
|
| 47 |
+
* to use as global parameters to pass to each service.
|
| 48 |
+
* @param array $globalParameters Global parameters to pass to every service as it is instantiated.
|
| 49 |
+
*
|
| 50 |
+
* @return Aws
|
| 51 |
+
*/
|
| 52 |
+
public static function factory($config = null, array $globalParameters = array())
|
| 53 |
+
{
|
| 54 |
+
if (!$config) {
|
| 55 |
+
// If nothing is passed in, then use the default configuration file with credentials from the environment
|
| 56 |
+
$config = self::getDefaultServiceDefinition();
|
| 57 |
+
} elseif (is_array($config)) {
|
| 58 |
+
// If an array was passed, then use the default configuration file with parameter overrides
|
| 59 |
+
$globalParameters = $config;
|
| 60 |
+
$config = self::getDefaultServiceDefinition();
|
| 61 |
+
}
|
| 62 |
+
$loader = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilderLoader();
|
| 63 |
+
$loader->addAlias('_aws', self::getDefaultServiceDefinition())->addAlias('_sdk1', __DIR__ . '/Resources/sdk1-config.php');
|
| 64 |
+
return $loader->load($config, $globalParameters);
|
| 65 |
+
}
|
| 66 |
+
/**
|
| 67 |
+
* Get the full path to the default service builder definition file
|
| 68 |
+
*
|
| 69 |
+
* @return string
|
| 70 |
+
*/
|
| 71 |
+
public static function getDefaultServiceDefinition()
|
| 72 |
+
{
|
| 73 |
+
return __DIR__ . '/Resources/aws-config.php';
|
| 74 |
+
}
|
| 75 |
+
/**
|
| 76 |
+
* Returns the configuration for the service builder
|
| 77 |
+
*
|
| 78 |
+
* @return array
|
| 79 |
+
*/
|
| 80 |
+
public function getConfig()
|
| 81 |
+
{
|
| 82 |
+
return $this->builderConfig;
|
| 83 |
+
}
|
| 84 |
+
/**
|
| 85 |
+
* Enables the facades for the clients defined in the service builder
|
| 86 |
+
*
|
| 87 |
+
* @param string|null $namespace The namespace that the facades should be mounted to. Defaults to global namespace
|
| 88 |
+
*
|
| 89 |
+
* @return Aws
|
| 90 |
+
* @deprecated "Facades" are being removed in version 3.0 of the SDK.
|
| 91 |
+
*/
|
| 92 |
+
public function enableFacades($namespace = null)
|
| 93 |
+
{
|
| 94 |
+
\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade::mountFacades($this, $namespace);
|
| 95 |
+
return $this;
|
| 96 |
+
}
|
| 97 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\TransferException;
|
| 24 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider;
|
| 25 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\EndpointSignatureInterface;
|
| 26 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
|
| 27 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureListener;
|
| 28 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterClassFactory;
|
| 29 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\CompositeWaiterFactory;
|
| 30 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface;
|
| 31 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfigFactory;
|
| 32 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
|
| 33 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\CurlException;
|
| 34 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryAggregator\DuplicateAggregator;
|
| 35 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Client;
|
| 36 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescriptionInterface;
|
| 37 |
+
/**
|
| 38 |
+
* Abstract AWS client
|
| 39 |
+
*/
|
| 40 |
+
abstract class AbstractClient extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Client implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface
|
| 41 |
+
{
|
| 42 |
+
/** @var CredentialsInterface AWS credentials */
|
| 43 |
+
protected $credentials;
|
| 44 |
+
/** @var SignatureInterface Signature implementation of the service */
|
| 45 |
+
protected $signature;
|
| 46 |
+
/** @var WaiterFactoryInterface Factory used to create waiter classes */
|
| 47 |
+
protected $waiterFactory;
|
| 48 |
+
/** @var DuplicateAggregator Cached query aggregator*/
|
| 49 |
+
protected $aggregator;
|
| 50 |
+
/**
|
| 51 |
+
* {@inheritdoc}
|
| 52 |
+
*/
|
| 53 |
+
public static function getAllEvents()
|
| 54 |
+
{
|
| 55 |
+
return array_merge(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Client::getAllEvents(), array('client.region_changed', 'client.credentials_changed'));
|
| 56 |
+
}
|
| 57 |
+
/**
|
| 58 |
+
* @param CredentialsInterface $credentials AWS credentials
|
| 59 |
+
* @param SignatureInterface $signature Signature implementation
|
| 60 |
+
* @param Collection $config Configuration options
|
| 61 |
+
*
|
| 62 |
+
* @throws InvalidArgumentException if an endpoint provider isn't provided
|
| 63 |
+
*/
|
| 64 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface $signature, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 65 |
+
{
|
| 66 |
+
// Bootstrap with Guzzle
|
| 67 |
+
parent::__construct($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL), $config);
|
| 68 |
+
$this->credentials = $credentials;
|
| 69 |
+
$this->signature = $signature;
|
| 70 |
+
$this->aggregator = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryAggregator\DuplicateAggregator();
|
| 71 |
+
// Make sure the user agent is prefixed by the SDK version
|
| 72 |
+
$this->setUserAgent('aws-sdk-php2/' . \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws::VERSION, true);
|
| 73 |
+
// Add the event listener so that requests are signed before they are sent
|
| 74 |
+
$dispatcher = $this->getEventDispatcher();
|
| 75 |
+
$dispatcher->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureListener($credentials, $signature));
|
| 76 |
+
if ($backoff = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF)) {
|
| 77 |
+
$dispatcher->addSubscriber($backoff, -255);
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
public function __call($method, $args)
|
| 81 |
+
{
|
| 82 |
+
if (substr($method, 0, 3) === 'get' && substr($method, -8) === 'Iterator') {
|
| 83 |
+
// Allow magic method calls for iterators (e.g. $client->get<CommandName>Iterator($params))
|
| 84 |
+
$commandOptions = isset($args[0]) ? $args[0] : null;
|
| 85 |
+
$iteratorOptions = isset($args[1]) ? $args[1] : array();
|
| 86 |
+
return $this->getIterator(substr($method, 3, -8), $commandOptions, $iteratorOptions);
|
| 87 |
+
} elseif (substr($method, 0, 9) == 'waitUntil') {
|
| 88 |
+
// Allow magic method calls for waiters (e.g. $client->waitUntil<WaiterName>($params))
|
| 89 |
+
return $this->waitUntil(substr($method, 9), isset($args[0]) ? $args[0] : array());
|
| 90 |
+
} else {
|
| 91 |
+
return parent::__call(ucfirst($method), $args);
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
/**
|
| 95 |
+
* Get an endpoint for a specific region from a service description
|
| 96 |
+
* @deprecated This function will no longer be updated to work with new regions.
|
| 97 |
+
*/
|
| 98 |
+
public static function getEndpoint(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescriptionInterface $description, $region, $scheme)
|
| 99 |
+
{
|
| 100 |
+
try {
|
| 101 |
+
$service = $description->getData('endpointPrefix');
|
| 102 |
+
$provider = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider::fromDefaults();
|
| 103 |
+
$result = $provider(array('service' => $service, 'region' => $region, 'scheme' => $scheme));
|
| 104 |
+
return $result['endpoint'];
|
| 105 |
+
} catch (\InvalidArgumentException $e) {
|
| 106 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException($e->getMessage(), 0, $e);
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
public function getCredentials()
|
| 110 |
+
{
|
| 111 |
+
return $this->credentials;
|
| 112 |
+
}
|
| 113 |
+
public function setCredentials(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
|
| 114 |
+
{
|
| 115 |
+
$formerCredentials = $this->credentials;
|
| 116 |
+
$this->credentials = $credentials;
|
| 117 |
+
// Dispatch an event that the credentials have been changed
|
| 118 |
+
$this->dispatch('client.credentials_changed', array('credentials' => $credentials, 'former_credentials' => $formerCredentials));
|
| 119 |
+
return $this;
|
| 120 |
+
}
|
| 121 |
+
public function getSignature()
|
| 122 |
+
{
|
| 123 |
+
return $this->signature;
|
| 124 |
+
}
|
| 125 |
+
public function getRegions()
|
| 126 |
+
{
|
| 127 |
+
return $this->serviceDescription->getData('regions');
|
| 128 |
+
}
|
| 129 |
+
public function getRegion()
|
| 130 |
+
{
|
| 131 |
+
return $this->getConfig(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION);
|
| 132 |
+
}
|
| 133 |
+
public function setRegion($region)
|
| 134 |
+
{
|
| 135 |
+
$config = $this->getConfig();
|
| 136 |
+
$formerRegion = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION);
|
| 137 |
+
$global = $this->serviceDescription->getData('globalEndpoint');
|
| 138 |
+
$provider = $config->get('endpoint_provider');
|
| 139 |
+
if (!$provider) {
|
| 140 |
+
throw new \RuntimeException('No endpoint provider configured');
|
| 141 |
+
}
|
| 142 |
+
// Only change the region if the service does not have a global endpoint
|
| 143 |
+
if (!$global || $this->serviceDescription->getData('namespace') === 'S3') {
|
| 144 |
+
$endpoint = call_user_func($provider, array('scheme' => $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SCHEME), 'region' => $region, 'service' => $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE)));
|
| 145 |
+
$this->setBaseUrl($endpoint['endpoint']);
|
| 146 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL, $endpoint['endpoint']);
|
| 147 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION, $region);
|
| 148 |
+
// Update the signature if necessary
|
| 149 |
+
$signature = $this->getSignature();
|
| 150 |
+
if ($signature instanceof EndpointSignatureInterface) {
|
| 151 |
+
/** @var EndpointSignatureInterface $signature */
|
| 152 |
+
$signature->setRegionName($region);
|
| 153 |
+
}
|
| 154 |
+
// Dispatch an event that the region has been changed
|
| 155 |
+
$this->dispatch('client.region_changed', array('region' => $region, 'former_region' => $formerRegion));
|
| 156 |
+
}
|
| 157 |
+
return $this;
|
| 158 |
+
}
|
| 159 |
+
public function waitUntil($waiter, array $input = array())
|
| 160 |
+
{
|
| 161 |
+
$this->getWaiter($waiter, $input)->wait();
|
| 162 |
+
return $this;
|
| 163 |
+
}
|
| 164 |
+
public function getWaiter($waiter, array $input = array())
|
| 165 |
+
{
|
| 166 |
+
return $this->getWaiterFactory()->build($waiter)->setClient($this)->setConfig($input);
|
| 167 |
+
}
|
| 168 |
+
public function setWaiterFactory(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface $waiterFactory)
|
| 169 |
+
{
|
| 170 |
+
$this->waiterFactory = $waiterFactory;
|
| 171 |
+
return $this;
|
| 172 |
+
}
|
| 173 |
+
public function getWaiterFactory()
|
| 174 |
+
{
|
| 175 |
+
if (!$this->waiterFactory) {
|
| 176 |
+
$clientClass = get_class($this);
|
| 177 |
+
// Use a composite factory that checks for classes first, then config waiters
|
| 178 |
+
$this->waiterFactory = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\CompositeWaiterFactory(array(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterClassFactory(substr($clientClass, 0, strrpos($clientClass, '\\')) . '\\Waiter')));
|
| 179 |
+
if ($this->getDescription()) {
|
| 180 |
+
$waiterConfig = $this->getDescription()->getData('waiters') ?: array();
|
| 181 |
+
$this->waiterFactory->addFactory(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfigFactory($waiterConfig));
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
return $this->waiterFactory;
|
| 185 |
+
}
|
| 186 |
+
public function getApiVersion()
|
| 187 |
+
{
|
| 188 |
+
return $this->serviceDescription->getApiVersion();
|
| 189 |
+
}
|
| 190 |
+
/**
|
| 191 |
+
* {@inheritdoc}
|
| 192 |
+
* @throws \Aws\Common\Exception\TransferException
|
| 193 |
+
*/
|
| 194 |
+
public function send($requests)
|
| 195 |
+
{
|
| 196 |
+
try {
|
| 197 |
+
return parent::send($requests);
|
| 198 |
+
} catch (CurlException $e) {
|
| 199 |
+
$wrapped = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\TransferException($e->getMessage(), null, $e);
|
| 200 |
+
$wrapped->setCurlHandle($e->getCurlHandle())->setCurlInfo($e->getCurlInfo())->setError($e->getError(), $e->getErrorNo())->setRequest($e->getRequest());
|
| 201 |
+
throw $wrapped;
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
/**
|
| 205 |
+
* Ensures that the duplicate query string aggregator is used so that
|
| 206 |
+
* query string values are sent over the wire as foo=bar&foo=baz.
|
| 207 |
+
* {@inheritdoc}
|
| 208 |
+
*/
|
| 209 |
+
public function createRequest($method = 'GET', $uri = null, $headers = null, $body = null, array $options = array())
|
| 210 |
+
{
|
| 211 |
+
$request = parent::createRequest($method, $uri, $headers, $body, $options);
|
| 212 |
+
$request->getQuery()->setAggregator($this->aggregator);
|
| 213 |
+
return $request;
|
| 214 |
+
}
|
| 215 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AwsClientInterface.php
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterInterface;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\ClientInterface;
|
| 24 |
+
/**
|
| 25 |
+
* Interface that all AWS clients implement
|
| 26 |
+
*/
|
| 27 |
+
interface AwsClientInterface extends ClientInterface
|
| 28 |
+
{
|
| 29 |
+
/**
|
| 30 |
+
* Returns the AWS credentials associated with the client
|
| 31 |
+
*
|
| 32 |
+
* @return CredentialsInterface
|
| 33 |
+
*/
|
| 34 |
+
public function getCredentials();
|
| 35 |
+
/**
|
| 36 |
+
* Sets the credentials object associated with the client
|
| 37 |
+
*
|
| 38 |
+
* @param CredentialsInterface $credentials Credentials object to use
|
| 39 |
+
*
|
| 40 |
+
* @return self
|
| 41 |
+
*/
|
| 42 |
+
public function setCredentials(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials);
|
| 43 |
+
/**
|
| 44 |
+
* Returns the signature implementation used with the client
|
| 45 |
+
*
|
| 46 |
+
* @return SignatureInterface
|
| 47 |
+
*/
|
| 48 |
+
public function getSignature();
|
| 49 |
+
/**
|
| 50 |
+
* Get a list of available regions and region data
|
| 51 |
+
*
|
| 52 |
+
* @return array
|
| 53 |
+
*/
|
| 54 |
+
public function getRegions();
|
| 55 |
+
/**
|
| 56 |
+
* Get the name of the region to which the client is configured to send requests
|
| 57 |
+
*
|
| 58 |
+
* @return string
|
| 59 |
+
*/
|
| 60 |
+
public function getRegion();
|
| 61 |
+
/**
|
| 62 |
+
* Change the region to which the client is configured to send requests
|
| 63 |
+
*
|
| 64 |
+
* @param string $region Name of the region
|
| 65 |
+
*
|
| 66 |
+
* @return self
|
| 67 |
+
*/
|
| 68 |
+
public function setRegion($region);
|
| 69 |
+
/**
|
| 70 |
+
* Get the waiter factory being used by the client
|
| 71 |
+
*
|
| 72 |
+
* @return WaiterFactoryInterface
|
| 73 |
+
*/
|
| 74 |
+
public function getWaiterFactory();
|
| 75 |
+
/**
|
| 76 |
+
* Set the waiter factory to use with the client
|
| 77 |
+
*
|
| 78 |
+
* @param WaiterFactoryInterface $waiterFactory Factory used to create waiters
|
| 79 |
+
*
|
| 80 |
+
* @return self
|
| 81 |
+
*/
|
| 82 |
+
public function setWaiterFactory(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface $waiterFactory);
|
| 83 |
+
/**
|
| 84 |
+
* Wait until a resource is available or an associated waiter returns true
|
| 85 |
+
*
|
| 86 |
+
* @param string $waiter Name of the waiter
|
| 87 |
+
* @param array $input Values used as input for the underlying operation and to control the waiter
|
| 88 |
+
*
|
| 89 |
+
* @return self
|
| 90 |
+
*/
|
| 91 |
+
public function waitUntil($waiter, array $input = array());
|
| 92 |
+
/**
|
| 93 |
+
* Get a named waiter object
|
| 94 |
+
*
|
| 95 |
+
* @param string $waiter Name of the waiter
|
| 96 |
+
* @param array $input Values used as input for the underlying operation and to control the waiter
|
| 97 |
+
*
|
| 98 |
+
* @return WaiterInterface
|
| 99 |
+
*/
|
| 100 |
+
public function getWaiter($waiter, array $input = array());
|
| 101 |
+
/**
|
| 102 |
+
* Get the API version of the client (e.g. 2006-03-01)
|
| 103 |
+
*
|
| 104 |
+
* @return string
|
| 105 |
+
*/
|
| 106 |
+
public function getApiVersion();
|
| 107 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ClientBuilder.php
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\NullCredentials;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionListener;
|
| 24 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
|
| 25 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\NamespaceExceptionFactory;
|
| 26 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\DefaultXmlExceptionParser;
|
| 27 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
|
| 28 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIteratorFactory;
|
| 29 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider;
|
| 30 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\EndpointSignatureInterface;
|
| 31 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
|
| 32 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV2;
|
| 33 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV3Https;
|
| 34 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4;
|
| 35 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
|
| 36 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin;
|
| 37 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\CurlBackoffStrategy;
|
| 38 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\ExponentialBackoffStrategy;
|
| 39 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\HttpBackoffStrategy;
|
| 40 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\TruncatedBackoffStrategy;
|
| 41 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescription;
|
| 42 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorClassFactory;
|
| 43 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Log\LogAdapterInterface;
|
| 44 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Log\ClosureLogAdapter;
|
| 45 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffLogger;
|
| 46 |
+
/**
|
| 47 |
+
* Builder for creating AWS service clients
|
| 48 |
+
*/
|
| 49 |
+
class ClientBuilder
|
| 50 |
+
{
|
| 51 |
+
/**
|
| 52 |
+
* @var array Default client config
|
| 53 |
+
*/
|
| 54 |
+
protected static $commonConfigDefaults = array('scheme' => 'https');
|
| 55 |
+
/**
|
| 56 |
+
* @var array Default client requirements
|
| 57 |
+
*/
|
| 58 |
+
protected static $commonConfigRequirements = array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION);
|
| 59 |
+
/**
|
| 60 |
+
* @var string The namespace of the client
|
| 61 |
+
*/
|
| 62 |
+
protected $clientNamespace;
|
| 63 |
+
/**
|
| 64 |
+
* @var array The config options
|
| 65 |
+
*/
|
| 66 |
+
protected $config = array();
|
| 67 |
+
/**
|
| 68 |
+
* @var array The config defaults
|
| 69 |
+
*/
|
| 70 |
+
protected $configDefaults = array();
|
| 71 |
+
/**
|
| 72 |
+
* @var array The config requirements
|
| 73 |
+
*/
|
| 74 |
+
protected $configRequirements = array();
|
| 75 |
+
/**
|
| 76 |
+
* @var ExceptionParserInterface The Parser interface for the client
|
| 77 |
+
*/
|
| 78 |
+
protected $exceptionParser;
|
| 79 |
+
/**
|
| 80 |
+
* @var array Array of configuration data for iterators available for the client
|
| 81 |
+
*/
|
| 82 |
+
protected $iteratorsConfig = array();
|
| 83 |
+
/** @var string */
|
| 84 |
+
private $clientClass;
|
| 85 |
+
/** @var string */
|
| 86 |
+
private $serviceName;
|
| 87 |
+
/**
|
| 88 |
+
* Factory method for creating the client builder
|
| 89 |
+
*
|
| 90 |
+
* @param string $namespace The namespace of the client
|
| 91 |
+
*
|
| 92 |
+
* @return ClientBuilder
|
| 93 |
+
*/
|
| 94 |
+
public static function factory($namespace = null)
|
| 95 |
+
{
|
| 96 |
+
return new static($namespace);
|
| 97 |
+
}
|
| 98 |
+
/**
|
| 99 |
+
* Constructs a client builder
|
| 100 |
+
*
|
| 101 |
+
* @param string $namespace The namespace of the client
|
| 102 |
+
*/
|
| 103 |
+
public function __construct($namespace = null)
|
| 104 |
+
{
|
| 105 |
+
$this->clientNamespace = $namespace;
|
| 106 |
+
// Determine service and class name
|
| 107 |
+
$this->clientClass = 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Client\\DefaultClient';
|
| 108 |
+
if ($this->clientNamespace) {
|
| 109 |
+
$this->serviceName = substr($this->clientNamespace, strrpos($this->clientNamespace, '\\') + 1);
|
| 110 |
+
$this->clientClass = $this->clientNamespace . '\\' . $this->serviceName . 'Client';
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
/**
|
| 114 |
+
* Sets the config options
|
| 115 |
+
*
|
| 116 |
+
* @param array|Collection $config The config options
|
| 117 |
+
*
|
| 118 |
+
* @return ClientBuilder
|
| 119 |
+
*/
|
| 120 |
+
public function setConfig($config)
|
| 121 |
+
{
|
| 122 |
+
$this->config = $this->processArray($config);
|
| 123 |
+
return $this;
|
| 124 |
+
}
|
| 125 |
+
/**
|
| 126 |
+
* Sets the config options' defaults
|
| 127 |
+
*
|
| 128 |
+
* @param array|Collection $defaults The default values
|
| 129 |
+
*
|
| 130 |
+
* @return ClientBuilder
|
| 131 |
+
*/
|
| 132 |
+
public function setConfigDefaults($defaults)
|
| 133 |
+
{
|
| 134 |
+
$this->configDefaults = $this->processArray($defaults);
|
| 135 |
+
return $this;
|
| 136 |
+
}
|
| 137 |
+
/**
|
| 138 |
+
* Sets the required config options
|
| 139 |
+
*
|
| 140 |
+
* @param array|Collection $required The required config options
|
| 141 |
+
*
|
| 142 |
+
* @return ClientBuilder
|
| 143 |
+
*/
|
| 144 |
+
public function setConfigRequirements($required)
|
| 145 |
+
{
|
| 146 |
+
$this->configRequirements = $this->processArray($required);
|
| 147 |
+
return $this;
|
| 148 |
+
}
|
| 149 |
+
/**
|
| 150 |
+
* Sets the exception parser. If one is not provided the builder will use
|
| 151 |
+
* the default XML exception parser.
|
| 152 |
+
*
|
| 153 |
+
* @param ExceptionParserInterface $parser The exception parser
|
| 154 |
+
*
|
| 155 |
+
* @return ClientBuilder
|
| 156 |
+
*/
|
| 157 |
+
public function setExceptionParser(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $parser)
|
| 158 |
+
{
|
| 159 |
+
$this->exceptionParser = $parser;
|
| 160 |
+
return $this;
|
| 161 |
+
}
|
| 162 |
+
/**
|
| 163 |
+
* Set the configuration for the client's iterators
|
| 164 |
+
*
|
| 165 |
+
* @param array $config Configuration data for client's iterators
|
| 166 |
+
*
|
| 167 |
+
* @return ClientBuilder
|
| 168 |
+
*/
|
| 169 |
+
public function setIteratorsConfig(array $config)
|
| 170 |
+
{
|
| 171 |
+
$this->iteratorsConfig = $config;
|
| 172 |
+
return $this;
|
| 173 |
+
}
|
| 174 |
+
/**
|
| 175 |
+
* Performs the building logic using all of the parameters that have been
|
| 176 |
+
* set and falling back to default values. Returns an instantiate service
|
| 177 |
+
* client with credentials prepared and plugins attached.
|
| 178 |
+
*
|
| 179 |
+
* @return AwsClientInterface
|
| 180 |
+
* @throws InvalidArgumentException
|
| 181 |
+
*/
|
| 182 |
+
public function build()
|
| 183 |
+
{
|
| 184 |
+
// Resolve configuration
|
| 185 |
+
$config = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig($this->config, array_merge(self::$commonConfigDefaults, $this->configDefaults), self::$commonConfigRequirements + $this->configRequirements);
|
| 186 |
+
if ($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION] === 'latest') {
|
| 187 |
+
$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION] = constant("{$this->clientClass}::LATEST_API_VERSION");
|
| 188 |
+
}
|
| 189 |
+
if (!isset($config['endpoint_provider'])) {
|
| 190 |
+
$config['endpoint_provider'] = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider::fromDefaults();
|
| 191 |
+
}
|
| 192 |
+
// Resolve the endpoint, signature, and credentials
|
| 193 |
+
$description = $this->updateConfigFromDescription($config);
|
| 194 |
+
$signature = $this->getSignature($description, $config);
|
| 195 |
+
$credentials = $this->getCredentials($config);
|
| 196 |
+
$this->extractHttpConfig($config);
|
| 197 |
+
// Resolve exception parser
|
| 198 |
+
if (!$this->exceptionParser) {
|
| 199 |
+
$this->exceptionParser = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\DefaultXmlExceptionParser();
|
| 200 |
+
}
|
| 201 |
+
// Resolve backoff strategy
|
| 202 |
+
$backoff = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF);
|
| 203 |
+
if ($backoff === null) {
|
| 204 |
+
$retries = isset($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_RETRIES]) ? $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_RETRIES] : 3;
|
| 205 |
+
$backoff = $this->createDefaultBackoff($retries);
|
| 206 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF, $backoff);
|
| 207 |
+
}
|
| 208 |
+
if ($backoff) {
|
| 209 |
+
$this->addBackoffLogger($backoff, $config);
|
| 210 |
+
}
|
| 211 |
+
/** @var AwsClientInterface $client */
|
| 212 |
+
$client = new $this->clientClass($credentials, $signature, $config);
|
| 213 |
+
$client->setDescription($description);
|
| 214 |
+
// Add exception marshaling so that more descriptive exception are thrown
|
| 215 |
+
if ($this->clientNamespace) {
|
| 216 |
+
$exceptionFactory = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\NamespaceExceptionFactory($this->exceptionParser, "{$this->clientNamespace}\\Exception", "{$this->clientNamespace}\\Exception\\{$this->serviceName}Exception");
|
| 217 |
+
$client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionListener($exceptionFactory));
|
| 218 |
+
}
|
| 219 |
+
// Add the UserAgentPlugin to append to the User-Agent header of requests
|
| 220 |
+
$client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\UserAgentListener());
|
| 221 |
+
// Filters used for the cache plugin
|
| 222 |
+
$client->getConfig()->set('params.cache.key_filter', 'header=date,x-amz-date,x-amz-security-token,x-amzn-authorization');
|
| 223 |
+
// Set the iterator resource factory based on the provided iterators config
|
| 224 |
+
$client->setResourceIteratorFactory(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIteratorFactory($this->iteratorsConfig, new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorClassFactory($this->clientNamespace . '\\Iterator')));
|
| 225 |
+
// Disable parameter validation if needed
|
| 226 |
+
if ($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VALIDATION) === false) {
|
| 227 |
+
$params = $config->get('command.params') ?: array();
|
| 228 |
+
$params['command.disable_validation'] = true;
|
| 229 |
+
$config->set('command.params', $params);
|
| 230 |
+
}
|
| 231 |
+
return $client;
|
| 232 |
+
}
|
| 233 |
+
/**
|
| 234 |
+
* Add backoff logging to the backoff plugin if needed
|
| 235 |
+
*
|
| 236 |
+
* @param BackoffPlugin $plugin Backoff plugin
|
| 237 |
+
* @param Collection $config Configuration settings
|
| 238 |
+
*
|
| 239 |
+
* @throws InvalidArgumentException
|
| 240 |
+
*/
|
| 241 |
+
protected function addBackoffLogger(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin $plugin, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 242 |
+
{
|
| 243 |
+
// The log option can be set to `debug` or an instance of a LogAdapterInterface
|
| 244 |
+
if ($logger = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_LOGGER)) {
|
| 245 |
+
$format = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_LOGGER_TEMPLATE);
|
| 246 |
+
if ($logger === 'debug') {
|
| 247 |
+
$logger = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Log\ClosureLogAdapter(function ($message) {
|
| 248 |
+
trigger_error($message . "\n");
|
| 249 |
+
});
|
| 250 |
+
} elseif (!$logger instanceof LogAdapterInterface) {
|
| 251 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_LOGGER . ' must be set to `debug` or an instance of ' . 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Common\\Log\\LogAdapterInterface');
|
| 252 |
+
}
|
| 253 |
+
// Create the plugin responsible for logging exponential backoff retries
|
| 254 |
+
$logPlugin = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffLogger($logger);
|
| 255 |
+
// You can specify a custom format or use the default
|
| 256 |
+
if ($format) {
|
| 257 |
+
$logPlugin->setTemplate($format);
|
| 258 |
+
}
|
| 259 |
+
$plugin->addSubscriber($logPlugin);
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
/**
|
| 263 |
+
* Ensures that an array (e.g. for config data) is actually in array form
|
| 264 |
+
*
|
| 265 |
+
* @param array|Collection $array The array data
|
| 266 |
+
*
|
| 267 |
+
* @return array
|
| 268 |
+
* @throws InvalidArgumentException if the arg is not an array or Collection
|
| 269 |
+
*/
|
| 270 |
+
protected function processArray($array)
|
| 271 |
+
{
|
| 272 |
+
if ($array instanceof Collection) {
|
| 273 |
+
$array = $array->getAll();
|
| 274 |
+
}
|
| 275 |
+
if (!is_array($array)) {
|
| 276 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The config must be provided as an array or Collection.');
|
| 277 |
+
}
|
| 278 |
+
return $array;
|
| 279 |
+
}
|
| 280 |
+
/**
|
| 281 |
+
* Update a configuration object from a service description
|
| 282 |
+
*
|
| 283 |
+
* @param Collection $config Config to update
|
| 284 |
+
*
|
| 285 |
+
* @return ServiceDescription
|
| 286 |
+
* @throws InvalidArgumentException
|
| 287 |
+
*/
|
| 288 |
+
protected function updateConfigFromDescription(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 289 |
+
{
|
| 290 |
+
$description = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION);
|
| 291 |
+
if (!$description instanceof ServiceDescription) {
|
| 292 |
+
// Inject the version into the sprintf template if it is a string
|
| 293 |
+
if (is_string($description)) {
|
| 294 |
+
$description = sprintf($description, $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION));
|
| 295 |
+
}
|
| 296 |
+
$description = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescription::factory($description);
|
| 297 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION, $description);
|
| 298 |
+
}
|
| 299 |
+
if (!$config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE)) {
|
| 300 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE, $description->getData('endpointPrefix'));
|
| 301 |
+
}
|
| 302 |
+
if ($iterators = $description->getData('iterators')) {
|
| 303 |
+
$this->setIteratorsConfig($iterators);
|
| 304 |
+
}
|
| 305 |
+
$this->handleRegion($config);
|
| 306 |
+
$this->handleEndpoint($config);
|
| 307 |
+
return $description;
|
| 308 |
+
}
|
| 309 |
+
/**
|
| 310 |
+
* Return an appropriate signature object for a a client based on the
|
| 311 |
+
* "signature" configuration setting, or the default signature specified in
|
| 312 |
+
* a service description. The signature can be set to a valid signature
|
| 313 |
+
* version identifier string or an instance of Aws\Common\Signature\SignatureInterface.
|
| 314 |
+
*
|
| 315 |
+
* @param ServiceDescription $description Description that holds a signature option
|
| 316 |
+
* @param Collection $config Configuration options
|
| 317 |
+
*
|
| 318 |
+
* @return SignatureInterface
|
| 319 |
+
* @throws InvalidArgumentException
|
| 320 |
+
*/
|
| 321 |
+
protected function getSignature(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescription $description, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 322 |
+
{
|
| 323 |
+
// If a custom signature has not been provided, then use the default
|
| 324 |
+
// signature setting specified in the service description.
|
| 325 |
+
$signature = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE) ?: $description->getData('signatureVersion');
|
| 326 |
+
if (is_string($signature)) {
|
| 327 |
+
if ($signature == 'v4') {
|
| 328 |
+
$signature = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4();
|
| 329 |
+
} elseif ($signature == 'v2') {
|
| 330 |
+
$signature = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV2();
|
| 331 |
+
} elseif ($signature == 'v3https') {
|
| 332 |
+
$signature = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV3Https();
|
| 333 |
+
} else {
|
| 334 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("Invalid signature type: {$signature}");
|
| 335 |
+
}
|
| 336 |
+
} elseif (!$signature instanceof SignatureInterface) {
|
| 337 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The provided signature is not ' . 'a signature version string or an instance of ' . 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Signature\\SignatureInterface');
|
| 338 |
+
}
|
| 339 |
+
// Allow a custom service name or region value to be provided
|
| 340 |
+
if ($signature instanceof EndpointSignatureInterface) {
|
| 341 |
+
// Determine the service name to use when signing
|
| 342 |
+
$signature->setServiceName($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE_SERVICE) ?: $description->getData('signingName') ?: $description->getData('endpointPrefix'));
|
| 343 |
+
// Determine the region to use when signing requests
|
| 344 |
+
$signature->setRegionName($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE_REGION) ?: $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION));
|
| 345 |
+
}
|
| 346 |
+
return $signature;
|
| 347 |
+
}
|
| 348 |
+
protected function getCredentials(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 349 |
+
{
|
| 350 |
+
$credentials = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS);
|
| 351 |
+
if (is_array($credentials)) {
|
| 352 |
+
$credentials = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials::factory($credentials);
|
| 353 |
+
} elseif ($credentials === false) {
|
| 354 |
+
$credentials = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\NullCredentials();
|
| 355 |
+
} elseif (!$credentials instanceof CredentialsInterface) {
|
| 356 |
+
$credentials = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials::factory($config);
|
| 357 |
+
}
|
| 358 |
+
return $credentials;
|
| 359 |
+
}
|
| 360 |
+
private function handleRegion(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 361 |
+
{
|
| 362 |
+
// Make sure a valid region is set
|
| 363 |
+
$region = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION];
|
| 364 |
+
$description = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION];
|
| 365 |
+
$global = $description->getData('globalEndpoint');
|
| 366 |
+
if (!$global && !$region) {
|
| 367 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('A region is required when using ' . $description->getData('serviceFullName'));
|
| 368 |
+
} elseif ($global && !$region) {
|
| 369 |
+
$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION] = 'us-east-1';
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
private function handleEndpoint(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 373 |
+
{
|
| 374 |
+
// Alias "endpoint" with "base_url" for forwards compatibility.
|
| 375 |
+
if ($config['endpoint']) {
|
| 376 |
+
$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL] = $config['endpoint'];
|
| 377 |
+
return;
|
| 378 |
+
}
|
| 379 |
+
if ($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL]) {
|
| 380 |
+
return;
|
| 381 |
+
}
|
| 382 |
+
$endpoint = call_user_func($config['endpoint_provider'], array('scheme' => $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SCHEME], 'region' => $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION], 'service' => $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE]));
|
| 383 |
+
$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL] = $endpoint['endpoint'];
|
| 384 |
+
// Set a signature if one was not explicitly provided.
|
| 385 |
+
if (!$config->hasKey(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE) && isset($endpoint['signatureVersion'])) {
|
| 386 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE, $endpoint['signatureVersion']);
|
| 387 |
+
}
|
| 388 |
+
// The the signing region if endpoint rule specifies one.
|
| 389 |
+
if (isset($endpoint['credentialScope'])) {
|
| 390 |
+
$scope = $endpoint['credentialScope'];
|
| 391 |
+
if (isset($scope['region'])) {
|
| 392 |
+
$config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE_REGION, $scope['region']);
|
| 393 |
+
}
|
| 394 |
+
}
|
| 395 |
+
}
|
| 396 |
+
private function createDefaultBackoff($retries = 3)
|
| 397 |
+
{
|
| 398 |
+
return new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin(
|
| 399 |
+
// Retry failed requests up to 3 times if it is determined that the request can be retried
|
| 400 |
+
new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\TruncatedBackoffStrategy(
|
| 401 |
+
$retries,
|
| 402 |
+
// Retry failed requests with 400-level responses due to throttling
|
| 403 |
+
new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ThrottlingErrorChecker(
|
| 404 |
+
$this->exceptionParser,
|
| 405 |
+
// Retry failed requests due to transient network or cURL problems
|
| 406 |
+
new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\CurlBackoffStrategy(
|
| 407 |
+
null,
|
| 408 |
+
// Retry failed requests with 500-level responses
|
| 409 |
+
new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\HttpBackoffStrategy(
|
| 410 |
+
array(500, 503, 509),
|
| 411 |
+
// Retry requests that failed due to expired credentials
|
| 412 |
+
new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ExpiredCredentialsChecker($this->exceptionParser, new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\ExponentialBackoffStrategy())
|
| 413 |
+
)
|
| 414 |
+
)
|
| 415 |
+
)
|
| 416 |
+
)
|
| 417 |
+
);
|
| 418 |
+
}
|
| 419 |
+
private function extractHttpConfig(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
|
| 420 |
+
{
|
| 421 |
+
$http = $config['http'];
|
| 422 |
+
if (!is_array($http)) {
|
| 423 |
+
return;
|
| 424 |
+
}
|
| 425 |
+
if (isset($http['verify'])) {
|
| 426 |
+
$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SSL_CERT] = $http['verify'];
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/DefaultClient.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
|
| 21 |
+
/**
|
| 22 |
+
* Generic client for interacting with an AWS service
|
| 23 |
+
*/
|
| 24 |
+
class DefaultClient extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AbstractClient
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Factory method to create a default client using an array of configuration options.
|
| 28 |
+
*
|
| 29 |
+
* The following array keys and values are available options:
|
| 30 |
+
*
|
| 31 |
+
* Credential options ((`key`, `secret`, and optional `token`) OR `credentials` is required):
|
| 32 |
+
*
|
| 33 |
+
* - key: AWS Access Key ID
|
| 34 |
+
* - secret: AWS secret access key
|
| 35 |
+
* - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
|
| 36 |
+
* - token: Custom AWS security token to use with request authentication. Please note that not all services accept temporary credentials. See http://docs.aws.amazon.com/STS/latest/UsingSTS/UsingTokens.html
|
| 37 |
+
* - token.ttd: UNIX timestamp for when the custom credentials expire
|
| 38 |
+
* - credentials.cache.key: Optional custom cache key to use with the credentials
|
| 39 |
+
* - credentials.client: Pass this option to specify a custom `Guzzle\Http\ClientInterface` to use if your credentials require a HTTP request (e.g. RefreshableInstanceProfileCredentials)
|
| 40 |
+
*
|
| 41 |
+
* Region and endpoint options (Some services do not require a region while others do. Check the service specific user guide documentation for details):
|
| 42 |
+
*
|
| 43 |
+
* - region: Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
|
| 44 |
+
* - scheme: URI Scheme of the base URL (e.g. 'https', 'http') used when endpoint is not supplied
|
| 45 |
+
* - endpoint: Allows you to specify a custom endpoint instead of building one from the region and scheme
|
| 46 |
+
*
|
| 47 |
+
* Generic client options:
|
| 48 |
+
*
|
| 49 |
+
* - signature: Overrides the signature used by the client. Clients will always choose an appropriate default signature. However, it can be useful to override this with a custom setting. This can be set to "v4", "v3https", "v2" or an instance of Aws\Common\Signature\SignatureInterface.
|
| 50 |
+
* - ssl.certificate_authority: Set to true to use the bundled CA cert or pass the full path to an SSL certificate bundle
|
| 51 |
+
* - curl.options: Associative of CURLOPT_* cURL options to add to each request
|
| 52 |
+
* - client.backoff.logger: `Guzzle\Log\LogAdapterInterface` object used to log backoff retries. Use 'debug' to emit PHP warnings when a retry is issued.
|
| 53 |
+
* - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See `Guzzle\Plugin\Backoff\BackoffLogger` for formatting information.
|
| 54 |
+
*
|
| 55 |
+
* @param array|Collection $config Client configuration data
|
| 56 |
+
*
|
| 57 |
+
* @return self
|
| 58 |
+
*/
|
| 59 |
+
public static function factory($config = array())
|
| 60 |
+
{
|
| 61 |
+
return \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ClientBuilder::factory()->setConfig($config)->setConfigDefaults(array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SCHEME => 'https'))->build();
|
| 62 |
+
}
|
| 63 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ExpiredCredentialsChecker.php
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
|
| 24 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
|
| 25 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface;
|
| 26 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
|
| 27 |
+
/**
|
| 28 |
+
* Backoff logic that handles retrying requests when credentials expire
|
| 29 |
+
*/
|
| 30 |
+
class ExpiredCredentialsChecker extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy
|
| 31 |
+
{
|
| 32 |
+
/**
|
| 33 |
+
* @var array Array of known retrying exception codes
|
| 34 |
+
*/
|
| 35 |
+
protected $retryable = array('RequestExpired' => true, 'ExpiredTokenException' => true, 'ExpiredToken' => true);
|
| 36 |
+
/**
|
| 37 |
+
* @var ExceptionParserInterface Exception parser used to parse exception responses
|
| 38 |
+
*/
|
| 39 |
+
protected $exceptionParser;
|
| 40 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $exceptionParser, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface $next = null)
|
| 41 |
+
{
|
| 42 |
+
$this->exceptionParser = $exceptionParser;
|
| 43 |
+
$this->next = $next;
|
| 44 |
+
}
|
| 45 |
+
public function makesDecision()
|
| 46 |
+
{
|
| 47 |
+
return true;
|
| 48 |
+
}
|
| 49 |
+
protected function getDelay($retries, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response = null, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException $e = null)
|
| 50 |
+
{
|
| 51 |
+
if ($response && $response->isClientError()) {
|
| 52 |
+
$parts = $this->exceptionParser->parse($request, $response);
|
| 53 |
+
if (!isset($this->retryable[$parts['code']]) || !$request->getClient()) {
|
| 54 |
+
return null;
|
| 55 |
+
}
|
| 56 |
+
/** @var AwsClientInterface $client */
|
| 57 |
+
$client = $request->getClient();
|
| 58 |
+
// Only retry if the credentials can be refreshed
|
| 59 |
+
if (!$client->getCredentials() instanceof AbstractRefreshableCredentials) {
|
| 60 |
+
return null;
|
| 61 |
+
}
|
| 62 |
+
// Resign the request using new credentials
|
| 63 |
+
$client->getSignature()->signRequest($request, $client->getCredentials()->setExpiration(-1));
|
| 64 |
+
// Retry immediately with no delay
|
| 65 |
+
return 0;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ThrottlingErrorChecker.php
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface;
|
| 24 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
|
| 25 |
+
/**
|
| 26 |
+
* Backoff logic that handles throttling exceptions from services
|
| 27 |
+
*/
|
| 28 |
+
class ThrottlingErrorChecker extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy
|
| 29 |
+
{
|
| 30 |
+
/** @var array Whitelist of exception codes (as indexes) that indicate throttling */
|
| 31 |
+
protected static $throttlingExceptions = array('RequestLimitExceeded' => true, 'Throttling' => true, 'ThrottlingException' => true, 'ProvisionedThroughputExceededException' => true, 'RequestThrottled' => true);
|
| 32 |
+
/**
|
| 33 |
+
* @var ExceptionParserInterface Exception parser used to parse exception responses
|
| 34 |
+
*/
|
| 35 |
+
protected $exceptionParser;
|
| 36 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $exceptionParser, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface $next = null)
|
| 37 |
+
{
|
| 38 |
+
$this->exceptionParser = $exceptionParser;
|
| 39 |
+
if ($next) {
|
| 40 |
+
$this->setNext($next);
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
/**
|
| 44 |
+
* {@inheritdoc}
|
| 45 |
+
*/
|
| 46 |
+
public function makesDecision()
|
| 47 |
+
{
|
| 48 |
+
return true;
|
| 49 |
+
}
|
| 50 |
+
/**
|
| 51 |
+
* {@inheritdoc}
|
| 52 |
+
*/
|
| 53 |
+
protected function getDelay($retries, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response = null, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException $e = null)
|
| 54 |
+
{
|
| 55 |
+
if ($response && $response->isClientError()) {
|
| 56 |
+
$parts = $this->exceptionParser->parse($request, $response);
|
| 57 |
+
return isset(self::$throttlingExceptions[$parts['code']]) ? true : null;
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UploadBodyListener.php
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\AbstractCommand as Command;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
| 24 |
+
/**
|
| 25 |
+
* Prepares the body parameter of a command such that the parameter is more flexible (e.g. accepts file handles) with
|
| 26 |
+
* the value it accepts but converts it to the correct format for the command. Also looks for a "Filename" parameter.
|
| 27 |
+
*/
|
| 28 |
+
class UploadBodyListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
|
| 29 |
+
{
|
| 30 |
+
/**
|
| 31 |
+
* @var array The names of the commands of which to modify the body parameter
|
| 32 |
+
*/
|
| 33 |
+
protected $commands;
|
| 34 |
+
/**
|
| 35 |
+
* @var string The key for the upload body parameter
|
| 36 |
+
*/
|
| 37 |
+
protected $bodyParameter;
|
| 38 |
+
/**
|
| 39 |
+
* @var string The key for the source file parameter
|
| 40 |
+
*/
|
| 41 |
+
protected $sourceParameter;
|
| 42 |
+
/**
|
| 43 |
+
* @param array $commands The commands to modify
|
| 44 |
+
* @param string $bodyParameter The key for the body parameter
|
| 45 |
+
* @param string $sourceParameter The key for the source file parameter
|
| 46 |
+
*/
|
| 47 |
+
public function __construct(array $commands, $bodyParameter = 'Body', $sourceParameter = 'SourceFile')
|
| 48 |
+
{
|
| 49 |
+
$this->commands = $commands;
|
| 50 |
+
$this->bodyParameter = (string) $bodyParameter;
|
| 51 |
+
$this->sourceParameter = (string) $sourceParameter;
|
| 52 |
+
}
|
| 53 |
+
/**
|
| 54 |
+
* {@inheritdoc}
|
| 55 |
+
*/
|
| 56 |
+
public static function getSubscribedEvents()
|
| 57 |
+
{
|
| 58 |
+
return array('command.before_prepare' => array('onCommandBeforePrepare'));
|
| 59 |
+
}
|
| 60 |
+
/**
|
| 61 |
+
* Converts filenames and file handles into EntityBody objects before the command is validated
|
| 62 |
+
*
|
| 63 |
+
* @param Event $event Event emitted
|
| 64 |
+
* @throws InvalidArgumentException
|
| 65 |
+
*/
|
| 66 |
+
public function onCommandBeforePrepare(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
|
| 67 |
+
{
|
| 68 |
+
/** @var Command $command */
|
| 69 |
+
$command = $event['command'];
|
| 70 |
+
if (in_array($command->getName(), $this->commands)) {
|
| 71 |
+
// Get the interesting parameters
|
| 72 |
+
$source = $command->get($this->sourceParameter);
|
| 73 |
+
$body = $command->get($this->bodyParameter);
|
| 74 |
+
// If a file path is passed in then get the file handle
|
| 75 |
+
if (is_string($source) && file_exists($source)) {
|
| 76 |
+
$body = fopen($source, 'r');
|
| 77 |
+
}
|
| 78 |
+
// Prepare the body parameter and remove the source file parameter
|
| 79 |
+
if (null !== $body) {
|
| 80 |
+
$command->remove($this->sourceParameter);
|
| 81 |
+
$command->set($this->bodyParameter, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($body));
|
| 82 |
+
} else {
|
| 83 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("You must specify a non-null value for the {$this->bodyParameter} or {$this->sourceParameter} parameters.");
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UserAgentListener.php
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
| 21 |
+
/**
|
| 22 |
+
* Listener used to append strings to the User-Agent header of a request based
|
| 23 |
+
* on the `ua.append` option. `ua.append` can contain a string or array of values.
|
| 24 |
+
*/
|
| 25 |
+
class UserAgentListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
|
| 26 |
+
{
|
| 27 |
+
/**
|
| 28 |
+
* @var string Option used to store User-Agent modifiers
|
| 29 |
+
*/
|
| 30 |
+
const OPTION = 'ua.append';
|
| 31 |
+
/**
|
| 32 |
+
* {@inheritdoc}
|
| 33 |
+
*/
|
| 34 |
+
public static function getSubscribedEvents()
|
| 35 |
+
{
|
| 36 |
+
return array('command.before_send' => 'onBeforeSend');
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Adds strings to the User-Agent header using the `ua.append` parameter of a command
|
| 40 |
+
*
|
| 41 |
+
* @param Event $event Event emitted
|
| 42 |
+
*/
|
| 43 |
+
public function onBeforeSend(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
|
| 44 |
+
{
|
| 45 |
+
$command = $event['command'];
|
| 46 |
+
if ($userAgentAppends = $command->get(self::OPTION)) {
|
| 47 |
+
$request = $command->getRequest();
|
| 48 |
+
$userAgent = (string) $request->getHeader('User-Agent');
|
| 49 |
+
foreach ((array) $userAgentAppends as $append) {
|
| 50 |
+
$append = ' ' . $append;
|
| 51 |
+
if (strpos($userAgent, $append) === false) {
|
| 52 |
+
$userAgent .= $append;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
$request->setHeader('User-Agent', $userAgent);
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/AwsQueryVisitor.php
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
|
| 4 |
+
|
| 5 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
|
| 6 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter;
|
| 7 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
|
| 8 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor;
|
| 9 |
+
/**
|
| 10 |
+
* Location visitor used to serialize AWS query parameters (e.g. EC2, SES, SNS, SQS, etc) as POST fields
|
| 11 |
+
*/
|
| 12 |
+
class AwsQueryVisitor extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor
|
| 13 |
+
{
|
| 14 |
+
private $fqname;
|
| 15 |
+
public function visit(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, $value)
|
| 16 |
+
{
|
| 17 |
+
$this->fqname = $command->getName();
|
| 18 |
+
$query = array();
|
| 19 |
+
$this->customResolver($value, $param, $query, $param->getWireName());
|
| 20 |
+
$request->addPostFields($query);
|
| 21 |
+
}
|
| 22 |
+
/**
|
| 23 |
+
* Map nested parameters into the location_key based parameters
|
| 24 |
+
*
|
| 25 |
+
* @param array $value Value to map
|
| 26 |
+
* @param Parameter $param Parameter that holds information about the current key
|
| 27 |
+
* @param array $query Built up query string values
|
| 28 |
+
* @param string $prefix String to prepend to sub query values
|
| 29 |
+
*/
|
| 30 |
+
protected function customResolver($value, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, array &$query, $prefix = '')
|
| 31 |
+
{
|
| 32 |
+
switch ($param->getType()) {
|
| 33 |
+
case 'object':
|
| 34 |
+
$this->resolveObject($param, $value, $prefix, $query);
|
| 35 |
+
break;
|
| 36 |
+
case 'array':
|
| 37 |
+
$this->resolveArray($param, $value, $prefix, $query);
|
| 38 |
+
break;
|
| 39 |
+
default:
|
| 40 |
+
$query[$prefix] = $param->filter($value);
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
/**
|
| 44 |
+
* Custom handling for objects
|
| 45 |
+
*
|
| 46 |
+
* @param Parameter $param Parameter for the object
|
| 47 |
+
* @param array $value Value that is set for this parameter
|
| 48 |
+
* @param string $prefix Prefix for the resulting key
|
| 49 |
+
* @param array $query Query string array passed by reference
|
| 50 |
+
*/
|
| 51 |
+
protected function resolveObject(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, array $value, $prefix, array &$query)
|
| 52 |
+
{
|
| 53 |
+
// Maps are implemented using additional properties
|
| 54 |
+
$hasAdditionalProperties = $param->getAdditionalProperties() instanceof Parameter;
|
| 55 |
+
$additionalPropertyCount = 0;
|
| 56 |
+
foreach ($value as $name => $v) {
|
| 57 |
+
if ($subParam = $param->getProperty($name)) {
|
| 58 |
+
// if the parameter was found by name as a regular property
|
| 59 |
+
$key = $prefix . '.' . $subParam->getWireName();
|
| 60 |
+
$this->customResolver($v, $subParam, $query, $key);
|
| 61 |
+
} elseif ($hasAdditionalProperties) {
|
| 62 |
+
// Handle map cases like &Attribute.1.Name=<name>&Attribute.1.Value=<value>
|
| 63 |
+
$additionalPropertyCount++;
|
| 64 |
+
$data = $param->getData();
|
| 65 |
+
$keyName = isset($data['keyName']) ? $data['keyName'] : 'key';
|
| 66 |
+
$valueName = isset($data['valueName']) ? $data['valueName'] : 'value';
|
| 67 |
+
$query["{$prefix}.{$additionalPropertyCount}.{$keyName}"] = $name;
|
| 68 |
+
$newPrefix = "{$prefix}.{$additionalPropertyCount}.{$valueName}";
|
| 69 |
+
if (is_array($v)) {
|
| 70 |
+
$this->customResolver($v, $param->getAdditionalProperties(), $query, $newPrefix);
|
| 71 |
+
} else {
|
| 72 |
+
$query[$newPrefix] = $param->filter($v);
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
/**
|
| 78 |
+
* Custom handling for arrays
|
| 79 |
+
*
|
| 80 |
+
* @param Parameter $param Parameter for the object
|
| 81 |
+
* @param array $value Value that is set for this parameter
|
| 82 |
+
* @param string $prefix Prefix for the resulting key
|
| 83 |
+
* @param array $query Query string array passed by reference
|
| 84 |
+
*/
|
| 85 |
+
protected function resolveArray(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, array $value, $prefix, array &$query)
|
| 86 |
+
{
|
| 87 |
+
static $serializeEmpty = array('SetLoadBalancerPoliciesForBackendServer' => 1, 'SetLoadBalancerPoliciesOfListener' => 1, 'UpdateStack' => 1);
|
| 88 |
+
// For BC, serialize empty lists for specific operations
|
| 89 |
+
if (!$value) {
|
| 90 |
+
if (isset($serializeEmpty[$this->fqname])) {
|
| 91 |
+
if (substr($prefix, -7) === '.member') {
|
| 92 |
+
$prefix = substr($prefix, 0, -7);
|
| 93 |
+
}
|
| 94 |
+
$query[$prefix] = '';
|
| 95 |
+
}
|
| 96 |
+
return;
|
| 97 |
+
}
|
| 98 |
+
$offset = $param->getData('offset') ?: 1;
|
| 99 |
+
foreach ($value as $index => $v) {
|
| 100 |
+
$index += $offset;
|
| 101 |
+
if (is_array($v) && ($items = $param->getItems())) {
|
| 102 |
+
$this->customResolver($v, $items, $query, $prefix . '.' . $index);
|
| 103 |
+
} else {
|
| 104 |
+
$query[$prefix . '.' . $index] = $param->filter($v);
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/JsonCommand.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Curl\CurlHandle;
|
| 21 |
+
/**
|
| 22 |
+
* Adds AWS JSON body functionality to dynamically generated HTTP requests
|
| 23 |
+
*/
|
| 24 |
+
class JsonCommand extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* {@inheritdoc}
|
| 28 |
+
*/
|
| 29 |
+
protected function build()
|
| 30 |
+
{
|
| 31 |
+
parent::build();
|
| 32 |
+
// Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
|
| 33 |
+
if (!$this->request->getBody()) {
|
| 34 |
+
$this->request->setBody('{}');
|
| 35 |
+
}
|
| 36 |
+
// Never send the Expect header when interacting with a JSON query service
|
| 37 |
+
$this->request->removeHeader('Expect');
|
| 38 |
+
// Always send JSON requests as a raw string rather than using streams to avoid issues with
|
| 39 |
+
// cURL error code 65: "necessary data rewind wasn't possible".
|
| 40 |
+
// This could be removed after PHP addresses https://bugs.php.net/bug.php?id=47204
|
| 41 |
+
$this->request->getCurlOptions()->set(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Curl\CurlHandle::BODY_AS_STRING, true);
|
| 42 |
+
}
|
| 43 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/QueryCommand.php
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
|
| 20 |
+
/**
|
| 21 |
+
* Adds AWS Query service serialization
|
| 22 |
+
*/
|
| 23 |
+
class QueryCommand extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* @var AwsQueryVisitor
|
| 27 |
+
*/
|
| 28 |
+
protected static $queryVisitor;
|
| 29 |
+
/**
|
| 30 |
+
* @var XmlResponseLocationVisitor
|
| 31 |
+
*/
|
| 32 |
+
protected static $xmlVisitor;
|
| 33 |
+
/**
|
| 34 |
+
* Register the aws.query visitor
|
| 35 |
+
*/
|
| 36 |
+
protected function init()
|
| 37 |
+
{
|
| 38 |
+
// @codeCoverageIgnoreStart
|
| 39 |
+
if (!self::$queryVisitor) {
|
| 40 |
+
self::$queryVisitor = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command\AwsQueryVisitor();
|
| 41 |
+
}
|
| 42 |
+
if (!self::$xmlVisitor) {
|
| 43 |
+
self::$xmlVisitor = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command\XmlResponseLocationVisitor();
|
| 44 |
+
}
|
| 45 |
+
// @codeCoverageIgnoreEnd
|
| 46 |
+
$this->getRequestSerializer()->addVisitor('aws.query', self::$queryVisitor);
|
| 47 |
+
$this->getResponseParser()->addVisitor('xml', self::$xmlVisitor);
|
| 48 |
+
}
|
| 49 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/XmlResponseLocationVisitor.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
|
| 4 |
+
|
| 5 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Operation;
|
| 6 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
|
| 7 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
|
| 8 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter;
|
| 9 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor;
|
| 10 |
+
/**
|
| 11 |
+
* Class used for custom AWS XML response parsing of query services
|
| 12 |
+
*/
|
| 13 |
+
class XmlResponseLocationVisitor extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor
|
| 14 |
+
{
|
| 15 |
+
/**
|
| 16 |
+
* {@inheritdoc}
|
| 17 |
+
*/
|
| 18 |
+
public function before(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, array &$result)
|
| 19 |
+
{
|
| 20 |
+
parent::before($command, $result);
|
| 21 |
+
// Unwrapped wrapped responses
|
| 22 |
+
$operation = $command->getOperation();
|
| 23 |
+
if ($operation->getServiceDescription()->getData('resultWrapped')) {
|
| 24 |
+
$wrappingNode = $operation->getName() . 'Result';
|
| 25 |
+
if (isset($result[$wrappingNode])) {
|
| 26 |
+
$result = $result[$wrappingNode] + $result;
|
| 27 |
+
unset($result[$wrappingNode]);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
/**
|
| 32 |
+
* Accounts for wrapper nodes
|
| 33 |
+
* {@inheritdoc}
|
| 34 |
+
*/
|
| 35 |
+
public function visit(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, &$value, $context = null)
|
| 36 |
+
{
|
| 37 |
+
parent::visit($command, $response, $param, $value, $context);
|
| 38 |
+
// Account for wrapper nodes (e.g. RDS, ElastiCache, etc)
|
| 39 |
+
if ($param->getData('wrapper')) {
|
| 40 |
+
$wireName = $param->getWireName();
|
| 41 |
+
$value += $value[$wireName];
|
| 42 |
+
unset($value[$wireName]);
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
/**
|
| 46 |
+
* Filter used when converting XML maps into associative arrays in service descriptions
|
| 47 |
+
*
|
| 48 |
+
* @param array $value Value to filter
|
| 49 |
+
* @param string $entryName Name of each entry
|
| 50 |
+
* @param string $keyName Name of each key
|
| 51 |
+
* @param string $valueName Name of each value
|
| 52 |
+
*
|
| 53 |
+
* @return array Returns the map of the XML data
|
| 54 |
+
*/
|
| 55 |
+
public static function xmlMap($value, $entryName, $keyName, $valueName)
|
| 56 |
+
{
|
| 57 |
+
$result = array();
|
| 58 |
+
foreach ($value as $entry) {
|
| 59 |
+
$result[$entry[$keyName]] = $entry[$valueName];
|
| 60 |
+
}
|
| 61 |
+
return $result;
|
| 62 |
+
}
|
| 63 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractCredentialsDecorator.php
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Abstract credentials decorator
|
| 21 |
+
*/
|
| 22 |
+
class AbstractCredentialsDecorator implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface
|
| 23 |
+
{
|
| 24 |
+
/**
|
| 25 |
+
* @var CredentialsInterface Wrapped credentials object
|
| 26 |
+
*/
|
| 27 |
+
protected $credentials;
|
| 28 |
+
/**
|
| 29 |
+
* Constructs a new BasicAWSCredentials object, with the specified AWS
|
| 30 |
+
* access key and AWS secret key
|
| 31 |
+
*
|
| 32 |
+
* @param CredentialsInterface $credentials
|
| 33 |
+
*/
|
| 34 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
|
| 35 |
+
{
|
| 36 |
+
$this->credentials = $credentials;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* {@inheritdoc}
|
| 40 |
+
*/
|
| 41 |
+
public function serialize()
|
| 42 |
+
{
|
| 43 |
+
return $this->credentials->serialize();
|
| 44 |
+
}
|
| 45 |
+
/**
|
| 46 |
+
* {@inheritdoc}
|
| 47 |
+
*/
|
| 48 |
+
public function unserialize($serialized)
|
| 49 |
+
{
|
| 50 |
+
$this->credentials = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials('', '');
|
| 51 |
+
$this->credentials->unserialize($serialized);
|
| 52 |
+
}
|
| 53 |
+
/**
|
| 54 |
+
* {@inheritdoc}
|
| 55 |
+
*/
|
| 56 |
+
public function getAccessKeyId()
|
| 57 |
+
{
|
| 58 |
+
return $this->credentials->getAccessKeyId();
|
| 59 |
+
}
|
| 60 |
+
/**
|
| 61 |
+
* {@inheritdoc}
|
| 62 |
+
*/
|
| 63 |
+
public function getSecretKey()
|
| 64 |
+
{
|
| 65 |
+
return $this->credentials->getSecretKey();
|
| 66 |
+
}
|
| 67 |
+
/**
|
| 68 |
+
* {@inheritdoc}
|
| 69 |
+
*/
|
| 70 |
+
public function getSecurityToken()
|
| 71 |
+
{
|
| 72 |
+
return $this->credentials->getSecurityToken();
|
| 73 |
+
}
|
| 74 |
+
/**
|
| 75 |
+
* {@inheritdoc}
|
| 76 |
+
*/
|
| 77 |
+
public function getExpiration()
|
| 78 |
+
{
|
| 79 |
+
return $this->credentials->getExpiration();
|
| 80 |
+
}
|
| 81 |
+
/**
|
| 82 |
+
* {@inheritdoc}
|
| 83 |
+
*/
|
| 84 |
+
public function isExpired()
|
| 85 |
+
{
|
| 86 |
+
return $this->credentials->isExpired();
|
| 87 |
+
}
|
| 88 |
+
/**
|
| 89 |
+
* {@inheritdoc}
|
| 90 |
+
*/
|
| 91 |
+
public function setAccessKeyId($key)
|
| 92 |
+
{
|
| 93 |
+
$this->credentials->setAccessKeyId($key);
|
| 94 |
+
return $this;
|
| 95 |
+
}
|
| 96 |
+
/**
|
| 97 |
+
* {@inheritdoc}
|
| 98 |
+
*/
|
| 99 |
+
public function setSecretKey($secret)
|
| 100 |
+
{
|
| 101 |
+
$this->credentials->setSecretKey($secret);
|
| 102 |
+
return $this;
|
| 103 |
+
}
|
| 104 |
+
/**
|
| 105 |
+
* {@inheritdoc}
|
| 106 |
+
*/
|
| 107 |
+
public function setSecurityToken($token)
|
| 108 |
+
{
|
| 109 |
+
$this->credentials->setSecurityToken($token);
|
| 110 |
+
return $this;
|
| 111 |
+
}
|
| 112 |
+
/**
|
| 113 |
+
* {@inheritdoc}
|
| 114 |
+
*/
|
| 115 |
+
public function setExpiration($timestamp)
|
| 116 |
+
{
|
| 117 |
+
$this->credentials->setExpiration($timestamp);
|
| 118 |
+
return $this;
|
| 119 |
+
}
|
| 120 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractRefreshableCredentials.php
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Abstract decorator to provide a foundation for refreshable credentials
|
| 21 |
+
*/
|
| 22 |
+
abstract class AbstractRefreshableCredentials extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractCredentialsDecorator
|
| 23 |
+
{
|
| 24 |
+
/**
|
| 25 |
+
* Get the underlying credentials, refreshing if necessary.
|
| 26 |
+
*
|
| 27 |
+
* @return Credentials
|
| 28 |
+
*/
|
| 29 |
+
public function getCredentials()
|
| 30 |
+
{
|
| 31 |
+
if ($this->credentials->isExpired()) {
|
| 32 |
+
$this->refresh();
|
| 33 |
+
}
|
| 34 |
+
return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials($this->credentials->getAccessKeyId(), $this->credentials->getSecretKey(), $this->credentials->getSecurityToken(), $this->credentials->getExpiration());
|
| 35 |
+
}
|
| 36 |
+
/**
|
| 37 |
+
* {@inheritdoc}
|
| 38 |
+
*/
|
| 39 |
+
public function getAccessKeyId()
|
| 40 |
+
{
|
| 41 |
+
if ($this->credentials->isExpired()) {
|
| 42 |
+
$this->refresh();
|
| 43 |
+
}
|
| 44 |
+
return $this->credentials->getAccessKeyId();
|
| 45 |
+
}
|
| 46 |
+
/**
|
| 47 |
+
* {@inheritdoc}
|
| 48 |
+
*/
|
| 49 |
+
public function getSecretKey()
|
| 50 |
+
{
|
| 51 |
+
if ($this->credentials->isExpired()) {
|
| 52 |
+
$this->refresh();
|
| 53 |
+
}
|
| 54 |
+
return $this->credentials->getSecretKey();
|
| 55 |
+
}
|
| 56 |
+
/**
|
| 57 |
+
* {@inheritdoc}
|
| 58 |
+
*/
|
| 59 |
+
public function getSecurityToken()
|
| 60 |
+
{
|
| 61 |
+
if ($this->credentials->isExpired()) {
|
| 62 |
+
$this->refresh();
|
| 63 |
+
}
|
| 64 |
+
return $this->credentials->getSecurityToken();
|
| 65 |
+
}
|
| 66 |
+
/**
|
| 67 |
+
* {@inheritdoc}
|
| 68 |
+
*/
|
| 69 |
+
public function serialize()
|
| 70 |
+
{
|
| 71 |
+
if ($this->credentials->isExpired()) {
|
| 72 |
+
$this->refresh();
|
| 73 |
+
}
|
| 74 |
+
return $this->credentials->serialize();
|
| 75 |
+
}
|
| 76 |
+
/**
|
| 77 |
+
* Attempt to get new credentials
|
| 78 |
+
*/
|
| 79 |
+
protected abstract function refresh();
|
| 80 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CacheableCredentials.php
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface;
|
| 20 |
+
/**
|
| 21 |
+
* Credentials decorator used to implement caching credentials
|
| 22 |
+
*/
|
| 23 |
+
class CacheableCredentials extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* @var CacheAdapterInterface Cache adapter used to store credentials
|
| 27 |
+
*/
|
| 28 |
+
protected $cache;
|
| 29 |
+
/**
|
| 30 |
+
* @var string Cache key used to store the credentials
|
| 31 |
+
*/
|
| 32 |
+
protected $cacheKey;
|
| 33 |
+
/**
|
| 34 |
+
* CacheableCredentials is a decorator that decorates other credentials
|
| 35 |
+
*
|
| 36 |
+
* @param CredentialsInterface $credentials Credentials to adapt
|
| 37 |
+
* @param CacheAdapterInterface $cache Cache to use to store credentials
|
| 38 |
+
* @param string $cacheKey Cache key of the credentials
|
| 39 |
+
*/
|
| 40 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface $cache, $cacheKey)
|
| 41 |
+
{
|
| 42 |
+
$this->cache = $cache;
|
| 43 |
+
$this->cacheKey = $cacheKey;
|
| 44 |
+
parent::__construct($credentials);
|
| 45 |
+
}
|
| 46 |
+
/**
|
| 47 |
+
* Attempt to get new credentials from cache or from the adapted object
|
| 48 |
+
*/
|
| 49 |
+
protected function refresh()
|
| 50 |
+
{
|
| 51 |
+
if (!($cache = $this->cache->fetch($this->cacheKey))) {
|
| 52 |
+
// The credentials were not found, so try again and cache if new
|
| 53 |
+
$this->credentials->getAccessKeyId();
|
| 54 |
+
if (!$this->credentials->isExpired()) {
|
| 55 |
+
// The credentials were updated, so cache them
|
| 56 |
+
$this->cache->save($this->cacheKey, $this->credentials, $this->credentials->getExpiration() - time());
|
| 57 |
+
}
|
| 58 |
+
} else {
|
| 59 |
+
// The credentials were found in cache, so update the adapter object
|
| 60 |
+
// if the cached credentials are not expired
|
| 61 |
+
if (!$cache->isExpired()) {
|
| 62 |
+
$this->credentials->setAccessKeyId($cache->getAccessKeyId());
|
| 63 |
+
$this->credentials->setSecretKey($cache->getSecretKey());
|
| 64 |
+
$this->credentials->setSecurityToken($cache->getSecurityToken());
|
| 65 |
+
$this->credentials->setExpiration($cache->getExpiration());
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/Credentials.php
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
|
| 21 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RequiredExtensionNotLoadedException;
|
| 22 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
|
| 23 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\FromConfigInterface;
|
| 24 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface;
|
| 25 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\DoctrineCacheAdapter;
|
| 26 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
|
| 27 |
+
/**
|
| 28 |
+
* Basic implementation of the AWSCredentials interface that allows callers to
|
| 29 |
+
* pass in the AWS access key and secret access in the constructor.
|
| 30 |
+
*/
|
| 31 |
+
class Credentials implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\FromConfigInterface
|
| 32 |
+
{
|
| 33 |
+
const ENV_KEY = 'AWS_ACCESS_KEY_ID';
|
| 34 |
+
const ENV_SECRET = 'AWS_SECRET_KEY';
|
| 35 |
+
const ENV_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY';
|
| 36 |
+
const ENV_PROFILE = 'AWS_PROFILE';
|
| 37 |
+
/** @var string AWS Access Key ID */
|
| 38 |
+
protected $key;
|
| 39 |
+
/** @var string AWS Secret Access Key */
|
| 40 |
+
protected $secret;
|
| 41 |
+
/** @var string AWS Security Token */
|
| 42 |
+
protected $token;
|
| 43 |
+
/** @var int Time to die of token */
|
| 44 |
+
protected $ttd;
|
| 45 |
+
/**
|
| 46 |
+
* Get the available keys for the factory method
|
| 47 |
+
*
|
| 48 |
+
* @return array
|
| 49 |
+
*/
|
| 50 |
+
public static function getConfigDefaults()
|
| 51 |
+
{
|
| 52 |
+
return array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::PROFILE => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE_KEY => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CLIENT => null);
|
| 53 |
+
}
|
| 54 |
+
/**
|
| 55 |
+
* Factory method for creating new credentials. This factory method will
|
| 56 |
+
* create the appropriate credentials object with appropriate decorators
|
| 57 |
+
* based on the passed configuration options.
|
| 58 |
+
*
|
| 59 |
+
* @param array $config Options to use when instantiating the credentials
|
| 60 |
+
*
|
| 61 |
+
* @return CredentialsInterface
|
| 62 |
+
* @throws InvalidArgumentException If the caching options are invalid
|
| 63 |
+
* @throws RuntimeException If using the default cache and APC is disabled
|
| 64 |
+
*/
|
| 65 |
+
public static function factory($config = array())
|
| 66 |
+
{
|
| 67 |
+
// Add default key values
|
| 68 |
+
foreach (self::getConfigDefaults() as $key => $value) {
|
| 69 |
+
if (!isset($config[$key])) {
|
| 70 |
+
$config[$key] = $value;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
// Set up the cache
|
| 74 |
+
$cache = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE];
|
| 75 |
+
$cacheKey = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE_KEY] ?: 'credentials_' . ($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY] ?: crc32(gethostname()));
|
| 76 |
+
if ($cacheKey && $cache instanceof CacheAdapterInterface && ($cached = self::createFromCache($cache, $cacheKey))) {
|
| 77 |
+
return $cached;
|
| 78 |
+
}
|
| 79 |
+
// Create the credentials object
|
| 80 |
+
if (!$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY] || !$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET]) {
|
| 81 |
+
$credentials = self::createFromEnvironment($config);
|
| 82 |
+
} else {
|
| 83 |
+
// Instantiate using short or long term credentials
|
| 84 |
+
$credentials = new static($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY], $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET], $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN], $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD]);
|
| 85 |
+
}
|
| 86 |
+
// Check if the credentials are refreshable, and if so, configure caching
|
| 87 |
+
$cache = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE];
|
| 88 |
+
if ($cacheKey && $cache) {
|
| 89 |
+
$credentials = self::createCache($credentials, $cache, $cacheKey);
|
| 90 |
+
}
|
| 91 |
+
return $credentials;
|
| 92 |
+
}
|
| 93 |
+
/**
|
| 94 |
+
* Create credentials from the credentials ini file in the HOME directory.
|
| 95 |
+
*
|
| 96 |
+
* @param string|null $profile Pass a specific profile to use. If no
|
| 97 |
+
* profile is specified we will attempt to use
|
| 98 |
+
* the value specified in the AWS_PROFILE
|
| 99 |
+
* environment variable. If AWS_PROFILE is not
|
| 100 |
+
* set, the "default" profile is used.
|
| 101 |
+
* @param string|null $filename Pass a string to specify the location of the
|
| 102 |
+
* credentials files. If null is passed, the
|
| 103 |
+
* SDK will attempt to find the configuration
|
| 104 |
+
* file at in your HOME directory at
|
| 105 |
+
* ~/.aws/credentials.
|
| 106 |
+
* @return CredentialsInterface
|
| 107 |
+
* @throws \RuntimeException if the file cannot be found, if the file is
|
| 108 |
+
* invalid, or if the profile is invalid.
|
| 109 |
+
*/
|
| 110 |
+
public static function fromIni($profile = null, $filename = null)
|
| 111 |
+
{
|
| 112 |
+
if (!$filename) {
|
| 113 |
+
$filename = self::getHomeDir() . '/.aws/credentials';
|
| 114 |
+
}
|
| 115 |
+
if (!$profile) {
|
| 116 |
+
$profile = self::getEnvVar(self::ENV_PROFILE) ?: 'default';
|
| 117 |
+
}
|
| 118 |
+
if (!is_readable($filename) || ($data = parse_ini_file($filename, true)) === false) {
|
| 119 |
+
throw new \RuntimeException("Invalid AWS credentials file: {$filename}.");
|
| 120 |
+
}
|
| 121 |
+
if (!isset($data[$profile]['aws_access_key_id']) || !isset($data[$profile]['aws_secret_access_key'])) {
|
| 122 |
+
throw new \RuntimeException("Invalid AWS credentials profile {$profile} in {$filename}.");
|
| 123 |
+
}
|
| 124 |
+
return new self($data[$profile]['aws_access_key_id'], $data[$profile]['aws_secret_access_key'], isset($data[$profile]['aws_security_token']) ? $data[$profile]['aws_security_token'] : null);
|
| 125 |
+
}
|
| 126 |
+
/**
|
| 127 |
+
* Constructs a new BasicAWSCredentials object, with the specified AWS
|
| 128 |
+
* access key and AWS secret key
|
| 129 |
+
*
|
| 130 |
+
* @param string $accessKeyId AWS access key ID
|
| 131 |
+
* @param string $secretAccessKey AWS secret access key
|
| 132 |
+
* @param string $token Security token to use
|
| 133 |
+
* @param int $expiration UNIX timestamp for when credentials expire
|
| 134 |
+
*/
|
| 135 |
+
public function __construct($accessKeyId, $secretAccessKey, $token = null, $expiration = null)
|
| 136 |
+
{
|
| 137 |
+
$this->key = trim($accessKeyId);
|
| 138 |
+
$this->secret = trim($secretAccessKey);
|
| 139 |
+
$this->token = $token;
|
| 140 |
+
$this->ttd = $expiration;
|
| 141 |
+
}
|
| 142 |
+
public function serialize()
|
| 143 |
+
{
|
| 144 |
+
return json_encode(array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY => $this->key, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET => $this->secret, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN => $this->token, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD => $this->ttd));
|
| 145 |
+
}
|
| 146 |
+
public function unserialize($serialized)
|
| 147 |
+
{
|
| 148 |
+
$data = json_decode($serialized, true);
|
| 149 |
+
$this->key = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY];
|
| 150 |
+
$this->secret = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET];
|
| 151 |
+
$this->token = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN];
|
| 152 |
+
$this->ttd = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD];
|
| 153 |
+
}
|
| 154 |
+
public function getAccessKeyId()
|
| 155 |
+
{
|
| 156 |
+
return $this->key;
|
| 157 |
+
}
|
| 158 |
+
public function getSecretKey()
|
| 159 |
+
{
|
| 160 |
+
return $this->secret;
|
| 161 |
+
}
|
| 162 |
+
public function getSecurityToken()
|
| 163 |
+
{
|
| 164 |
+
return $this->token;
|
| 165 |
+
}
|
| 166 |
+
public function getExpiration()
|
| 167 |
+
{
|
| 168 |
+
return $this->ttd;
|
| 169 |
+
}
|
| 170 |
+
public function isExpired()
|
| 171 |
+
{
|
| 172 |
+
return $this->ttd !== null && time() >= $this->ttd;
|
| 173 |
+
}
|
| 174 |
+
public function setAccessKeyId($key)
|
| 175 |
+
{
|
| 176 |
+
$this->key = $key;
|
| 177 |
+
return $this;
|
| 178 |
+
}
|
| 179 |
+
public function setSecretKey($secret)
|
| 180 |
+
{
|
| 181 |
+
$this->secret = $secret;
|
| 182 |
+
return $this;
|
| 183 |
+
}
|
| 184 |
+
public function setSecurityToken($token)
|
| 185 |
+
{
|
| 186 |
+
$this->token = $token;
|
| 187 |
+
return $this;
|
| 188 |
+
}
|
| 189 |
+
public function setExpiration($timestamp)
|
| 190 |
+
{
|
| 191 |
+
$this->ttd = $timestamp;
|
| 192 |
+
return $this;
|
| 193 |
+
}
|
| 194 |
+
/**
|
| 195 |
+
* When no keys are provided, attempt to create them based on the
|
| 196 |
+
* environment or instance profile credentials.
|
| 197 |
+
*
|
| 198 |
+
* @param array|Collection $config
|
| 199 |
+
*
|
| 200 |
+
* @return CredentialsInterface
|
| 201 |
+
*/
|
| 202 |
+
private static function createFromEnvironment($config)
|
| 203 |
+
{
|
| 204 |
+
// Get key and secret from ENV variables
|
| 205 |
+
$envKey = self::getEnvVar(self::ENV_KEY);
|
| 206 |
+
if (!($envSecret = self::getEnvVar(self::ENV_SECRET))) {
|
| 207 |
+
// Use AWS_SECRET_ACCESS_KEY if AWS_SECRET_KEY was not set
|
| 208 |
+
$envSecret = self::getEnvVar(self::ENV_SECRET_ACCESS_KEY);
|
| 209 |
+
}
|
| 210 |
+
// Use credentials from the environment variables if available
|
| 211 |
+
if ($envKey && $envSecret) {
|
| 212 |
+
return new static($envKey, $envSecret);
|
| 213 |
+
}
|
| 214 |
+
try {
|
| 215 |
+
// Use credentials from the INI file in HOME directory if available
|
| 216 |
+
return self::fromIni($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::PROFILE]);
|
| 217 |
+
} catch (\RuntimeException $e) {
|
| 218 |
+
// Otherwise, try using instance profile credentials (available on EC2 instances)
|
| 219 |
+
return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\RefreshableInstanceProfileCredentials(new static('', '', '', 1), $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CLIENT]);
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
private static function createFromCache(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface $cache, $cacheKey)
|
| 223 |
+
{
|
| 224 |
+
$cached = $cache->fetch($cacheKey);
|
| 225 |
+
if ($cached instanceof CredentialsInterface && !$cached->isExpired()) {
|
| 226 |
+
return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CacheableCredentials($cached, $cache, $cacheKey);
|
| 227 |
+
}
|
| 228 |
+
return null;
|
| 229 |
+
}
|
| 230 |
+
private static function createCache(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $cache, $cacheKey)
|
| 231 |
+
{
|
| 232 |
+
if ($cache === 'true' || $cache === true) {
|
| 233 |
+
// If no cache adapter was provided, then create one for the user
|
| 234 |
+
// @codeCoverageIgnoreStart
|
| 235 |
+
if (!extension_loaded('apc')) {
|
| 236 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RequiredExtensionNotLoadedException('PHP has not been compiled with APC. Unable to cache ' . 'the credentials.');
|
| 237 |
+
} elseif (!class_exists('DeliciousBrains\\WP_Offload_S3\\Aws2\\Doctrine\\Common\\Cache\\ApcCache')) {
|
| 238 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('Cannot set ' . \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE . ' to true because the Doctrine cache component is ' . 'not installed. Either install doctrine/cache or pass in an instantiated ' . 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Cache\\CacheAdapterInterface object');
|
| 239 |
+
}
|
| 240 |
+
// @codeCoverageIgnoreEnd
|
| 241 |
+
$cache = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\DoctrineCacheAdapter(new \DeliciousBrains\WP_Offload_S3\Aws2\Doctrine\Common\Cache\ApcCache());
|
| 242 |
+
} elseif (!$cache instanceof CacheAdapterInterface) {
|
| 243 |
+
throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Unable to utilize caching with the specified options');
|
| 244 |
+
}
|
| 245 |
+
// Decorate the credentials with a cache
|
| 246 |
+
return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CacheableCredentials($credentials, $cache, $cacheKey);
|
| 247 |
+
}
|
| 248 |
+
private static function getHomeDir()
|
| 249 |
+
{
|
| 250 |
+
// On Linux/Unix-like systems, use the HOME environment variable
|
| 251 |
+
if ($homeDir = self::getEnvVar('HOME')) {
|
| 252 |
+
return $homeDir;
|
| 253 |
+
}
|
| 254 |
+
// Get the HOMEDRIVE and HOMEPATH values for Windows hosts
|
| 255 |
+
$homeDrive = self::getEnvVar('HOMEDRIVE');
|
| 256 |
+
$homePath = self::getEnvVar('HOMEPATH');
|
| 257 |
+
return $homeDrive && $homePath ? $homeDrive . $homePath : null;
|
| 258 |
+
}
|
| 259 |
+
/**
|
| 260 |
+
* Fetches the value of an environment variable by checking $_SERVER and getenv().
|
| 261 |
+
*
|
| 262 |
+
* @param string $var Name of the environment variable
|
| 263 |
+
*
|
| 264 |
+
* @return mixed|null
|
| 265 |
+
*/
|
| 266 |
+
private static function getEnvVar($var)
|
| 267 |
+
{
|
| 268 |
+
return isset($_SERVER[$var]) ? $_SERVER[$var] : getenv($var);
|
| 269 |
+
}
|
| 270 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CredentialsInterface.php
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Provides access to the AWS credentials used for accessing AWS services: AWS
|
| 21 |
+
* access key ID, secret access key, and security token. These credentials are
|
| 22 |
+
* used to securely sign requests to AWS services.
|
| 23 |
+
*/
|
| 24 |
+
interface CredentialsInterface extends \Serializable
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Returns the AWS access key ID for this credentials object.
|
| 28 |
+
*
|
| 29 |
+
* @return string
|
| 30 |
+
*/
|
| 31 |
+
public function getAccessKeyId();
|
| 32 |
+
/**
|
| 33 |
+
* Returns the AWS secret access key for this credentials object.
|
| 34 |
+
*
|
| 35 |
+
* @return string
|
| 36 |
+
*/
|
| 37 |
+
public function getSecretKey();
|
| 38 |
+
/**
|
| 39 |
+
* Get the associated security token if available
|
| 40 |
+
*
|
| 41 |
+
* @return string|null
|
| 42 |
+
*/
|
| 43 |
+
public function getSecurityToken();
|
| 44 |
+
/**
|
| 45 |
+
* Get the UNIX timestamp in which the credentials will expire
|
| 46 |
+
*
|
| 47 |
+
* @return int|null
|
| 48 |
+
*/
|
| 49 |
+
public function getExpiration();
|
| 50 |
+
/**
|
| 51 |
+
* Set the AWS access key ID for this credentials object.
|
| 52 |
+
*
|
| 53 |
+
* @param string $key AWS access key ID
|
| 54 |
+
*
|
| 55 |
+
* @return self
|
| 56 |
+
*/
|
| 57 |
+
public function setAccessKeyId($key);
|
| 58 |
+
/**
|
| 59 |
+
* Set the AWS secret access key for this credentials object.
|
| 60 |
+
*
|
| 61 |
+
* @param string $secret AWS secret access key
|
| 62 |
+
*
|
| 63 |
+
* @return CredentialsInterface
|
| 64 |
+
*/
|
| 65 |
+
public function setSecretKey($secret);
|
| 66 |
+
/**
|
| 67 |
+
* Set the security token to use with this credentials object
|
| 68 |
+
*
|
| 69 |
+
* @param string $token Security token
|
| 70 |
+
*
|
| 71 |
+
* @return self
|
| 72 |
+
*/
|
| 73 |
+
public function setSecurityToken($token);
|
| 74 |
+
/**
|
| 75 |
+
* Set the UNIX timestamp in which the credentials will expire
|
| 76 |
+
*
|
| 77 |
+
* @param int $timestamp UNIX timestamp expiration
|
| 78 |
+
*
|
| 79 |
+
* @return self
|
| 80 |
+
*/
|
| 81 |
+
public function setExpiration($timestamp);
|
| 82 |
+
/**
|
| 83 |
+
* Check if the credentials are expired
|
| 84 |
+
*
|
| 85 |
+
* @return bool
|
| 86 |
+
*/
|
| 87 |
+
public function isExpired();
|
| 88 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/NullCredentials.php
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* A blank set of credentials. AWS clients must be provided credentials, but
|
| 7 |
+
* there are some types of requests that do not need authentication. This class
|
| 8 |
+
* can be used to pivot on that scenario, and also serve as a mock credentials
|
| 9 |
+
* object when testing
|
| 10 |
+
*
|
| 11 |
+
* @codeCoverageIgnore
|
| 12 |
+
*/
|
| 13 |
+
class NullCredentials implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface
|
| 14 |
+
{
|
| 15 |
+
public function getAccessKeyId()
|
| 16 |
+
{
|
| 17 |
+
return '';
|
| 18 |
+
}
|
| 19 |
+
public function getSecretKey()
|
| 20 |
+
{
|
| 21 |
+
return '';
|
| 22 |
+
}
|
| 23 |
+
public function getSecurityToken()
|
| 24 |
+
{
|
| 25 |
+
return null;
|
| 26 |
+
}
|
| 27 |
+
public function getExpiration()
|
| 28 |
+
{
|
| 29 |
+
return null;
|
| 30 |
+
}
|
| 31 |
+
public function isExpired()
|
| 32 |
+
{
|
| 33 |
+
return false;
|
| 34 |
+
}
|
| 35 |
+
public function serialize()
|
| 36 |
+
{
|
| 37 |
+
return 'N;';
|
| 38 |
+
}
|
| 39 |
+
public function unserialize($serialized)
|
| 40 |
+
{
|
| 41 |
+
// Nothing to do here.
|
| 42 |
+
}
|
| 43 |
+
public function setAccessKeyId($key)
|
| 44 |
+
{
|
| 45 |
+
// Nothing to do here.
|
| 46 |
+
}
|
| 47 |
+
public function setSecretKey($secret)
|
| 48 |
+
{
|
| 49 |
+
// Nothing to do here.
|
| 50 |
+
}
|
| 51 |
+
public function setSecurityToken($token)
|
| 52 |
+
{
|
| 53 |
+
// Nothing to do here.
|
| 54 |
+
}
|
| 55 |
+
public function setExpiration($timestamp)
|
| 56 |
+
{
|
| 57 |
+
// Nothing to do here.
|
| 58 |
+
}
|
| 59 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/RefreshableInstanceProfileCredentials.php
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InstanceProfileCredentialsException;
|
| 21 |
+
/**
|
| 22 |
+
* Credentials decorator used to implement retrieving credentials from the
|
| 23 |
+
* EC2 metadata server
|
| 24 |
+
*/
|
| 25 |
+
class RefreshableInstanceProfileCredentials extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials
|
| 26 |
+
{
|
| 27 |
+
/**
|
| 28 |
+
* @var InstanceMetadataClient
|
| 29 |
+
*/
|
| 30 |
+
protected $client;
|
| 31 |
+
/** @var bool */
|
| 32 |
+
private $customClient;
|
| 33 |
+
/**
|
| 34 |
+
* Constructs a new instance profile credentials decorator
|
| 35 |
+
*
|
| 36 |
+
* @param CredentialsInterface $credentials Credentials to adapt
|
| 37 |
+
* @param InstanceMetadataClient $client Client used to get new credentials
|
| 38 |
+
*/
|
| 39 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient $client = null)
|
| 40 |
+
{
|
| 41 |
+
parent::__construct($credentials);
|
| 42 |
+
$this->setClient($client);
|
| 43 |
+
}
|
| 44 |
+
public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient $client = null)
|
| 45 |
+
{
|
| 46 |
+
$this->customClient = null !== $client;
|
| 47 |
+
$this->client = $client ?: \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient::factory();
|
| 48 |
+
}
|
| 49 |
+
public function serialize()
|
| 50 |
+
{
|
| 51 |
+
$serializable = array('credentials' => parent::serialize(), 'customClient' => $this->customClient);
|
| 52 |
+
if ($this->customClient) {
|
| 53 |
+
$serializable['client'] = serialize($this->client);
|
| 54 |
+
}
|
| 55 |
+
return json_encode($serializable);
|
| 56 |
+
}
|
| 57 |
+
public function unserialize($value)
|
| 58 |
+
{
|
| 59 |
+
$serialized = json_decode($value, true);
|
| 60 |
+
parent::unserialize($serialized['credentials']);
|
| 61 |
+
$this->customClient = $serialized['customClient'];
|
| 62 |
+
$this->client = $this->customClient ? unserialize($serialized['client']) : \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient::factory();
|
| 63 |
+
}
|
| 64 |
+
/**
|
| 65 |
+
* Attempt to get new credentials from the instance profile
|
| 66 |
+
*
|
| 67 |
+
* @throws InstanceProfileCredentialsException On error
|
| 68 |
+
*/
|
| 69 |
+
protected function refresh()
|
| 70 |
+
{
|
| 71 |
+
$credentials = $this->client->getInstanceProfileCredentials();
|
| 72 |
+
// Expire the token 5 minutes early to pre-fetch before expiring.
|
| 73 |
+
$this->credentials->setAccessKeyId($credentials->getAccessKeyId())->setSecretKey($credentials->getSecretKey())->setSecurityToken($credentials->getSecurityToken())->setExpiration($credentials->getExpiration() - 300);
|
| 74 |
+
}
|
| 75 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Represents an enumerable set of values
|
| 21 |
+
*/
|
| 22 |
+
abstract class Enum
|
| 23 |
+
{
|
| 24 |
+
/**
|
| 25 |
+
* @var array A cache of all enum values to increase performance
|
| 26 |
+
*/
|
| 27 |
+
protected static $cache = array();
|
| 28 |
+
/**
|
| 29 |
+
* Returns the names (or keys) of all of constants in the enum
|
| 30 |
+
*
|
| 31 |
+
* @return array
|
| 32 |
+
*/
|
| 33 |
+
public static function keys()
|
| 34 |
+
{
|
| 35 |
+
return array_keys(static::values());
|
| 36 |
+
}
|
| 37 |
+
/**
|
| 38 |
+
* Return the names and values of all the constants in the enum
|
| 39 |
+
*
|
| 40 |
+
* @return array
|
| 41 |
+
*/
|
| 42 |
+
public static function values()
|
| 43 |
+
{
|
| 44 |
+
$class = get_called_class();
|
| 45 |
+
if (!isset(self::$cache[$class])) {
|
| 46 |
+
$reflected = new \ReflectionClass($class);
|
| 47 |
+
self::$cache[$class] = $reflected->getConstants();
|
| 48 |
+
}
|
| 49 |
+
return self::$cache[$class];
|
| 50 |
+
}
|
| 51 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/ClientOptions.php
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 20 |
+
/**
|
| 21 |
+
* Contains enumerable default factory options that can be passed to a client's factory method
|
| 22 |
+
*/
|
| 23 |
+
class ClientOptions extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* AWS Access Key ID
|
| 27 |
+
*
|
| 28 |
+
* @deprecated Use "credentials" instead.
|
| 29 |
+
*/
|
| 30 |
+
const KEY = 'key';
|
| 31 |
+
/**
|
| 32 |
+
* AWS secret access key
|
| 33 |
+
*
|
| 34 |
+
* @deprecated Use "credentials" instead.
|
| 35 |
+
*/
|
| 36 |
+
const SECRET = 'secret';
|
| 37 |
+
/**
|
| 38 |
+
* Custom AWS security token to use with request authentication.
|
| 39 |
+
*
|
| 40 |
+
* @deprecated Use "credentials" instead.
|
| 41 |
+
*/
|
| 42 |
+
const TOKEN = 'token';
|
| 43 |
+
/**
|
| 44 |
+
* Provide an array of "key", "secret", and "token" or an instance of
|
| 45 |
+
* `Aws\Common\Credentials\CredentialsInterface`.
|
| 46 |
+
*/
|
| 47 |
+
const CREDENTIALS = 'credentials';
|
| 48 |
+
/**
|
| 49 |
+
* @var string Name of a credential profile to read from your ~/.aws/credentials file
|
| 50 |
+
*/
|
| 51 |
+
const PROFILE = 'profile';
|
| 52 |
+
/**
|
| 53 |
+
* @var string UNIX timestamp for when the custom credentials expire
|
| 54 |
+
*/
|
| 55 |
+
const TOKEN_TTD = 'token.ttd';
|
| 56 |
+
/**
|
| 57 |
+
* @var string Used to cache credentials when using providers that require HTTP requests. Set the trueto use the
|
| 58 |
+
* default APC cache or provide a `Guzzle\Cache\CacheAdapterInterface` object.
|
| 59 |
+
*/
|
| 60 |
+
const CREDENTIALS_CACHE = 'credentials.cache';
|
| 61 |
+
/**
|
| 62 |
+
* @var string Optional custom cache key to use with the credentials
|
| 63 |
+
*/
|
| 64 |
+
const CREDENTIALS_CACHE_KEY = 'credentials.cache.key';
|
| 65 |
+
/**
|
| 66 |
+
* @var string Pass this option to specify a custom `Guzzle\Http\ClientInterface` to use if your credentials require
|
| 67 |
+
* a HTTP request (e.g. RefreshableInstanceProfileCredentials)
|
| 68 |
+
*/
|
| 69 |
+
const CREDENTIALS_CLIENT = 'credentials.client';
|
| 70 |
+
/**
|
| 71 |
+
* @var string Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
|
| 72 |
+
*/
|
| 73 |
+
const REGION = 'region';
|
| 74 |
+
/**
|
| 75 |
+
* @var string URI Scheme of the base URL (e.g. 'https', 'http').
|
| 76 |
+
*/
|
| 77 |
+
const SCHEME = 'scheme';
|
| 78 |
+
/**
|
| 79 |
+
* @var string Specify the name of the service
|
| 80 |
+
*/
|
| 81 |
+
const SERVICE = 'service';
|
| 82 |
+
/**
|
| 83 |
+
* Instead of using a `region` and `scheme`, you can specify a custom base
|
| 84 |
+
* URL for the client.
|
| 85 |
+
*
|
| 86 |
+
* @deprecated Use the "endpoint" option instead.
|
| 87 |
+
*/
|
| 88 |
+
const BASE_URL = 'base_url';
|
| 89 |
+
/**
|
| 90 |
+
* @var string You can optionally provide a custom signature implementation used to sign requests
|
| 91 |
+
*/
|
| 92 |
+
const SIGNATURE = 'signature';
|
| 93 |
+
/**
|
| 94 |
+
* @var string Set to explicitly override the service name used in signatures
|
| 95 |
+
*/
|
| 96 |
+
const SIGNATURE_SERVICE = 'signature.service';
|
| 97 |
+
/**
|
| 98 |
+
* @var string Set to explicitly override the region name used in signatures
|
| 99 |
+
*/
|
| 100 |
+
const SIGNATURE_REGION = 'signature.region';
|
| 101 |
+
/**
|
| 102 |
+
* @var string Option key holding an exponential backoff plugin
|
| 103 |
+
*/
|
| 104 |
+
const BACKOFF = 'client.backoff';
|
| 105 |
+
/**
|
| 106 |
+
* @var string Option key holding the exponential backoff retries
|
| 107 |
+
*/
|
| 108 |
+
const BACKOFF_RETRIES = 'client.backoff.retries';
|
| 109 |
+
/**
|
| 110 |
+
* @var string `Guzzle\Log\LogAdapterInterface` object used to log backoff retries. Use 'debug' to emit PHP
|
| 111 |
+
* warnings when a retry is issued.
|
| 112 |
+
*/
|
| 113 |
+
const BACKOFF_LOGGER = 'client.backoff.logger';
|
| 114 |
+
/**
|
| 115 |
+
* @var string Optional template to use for exponential backoff log messages. See
|
| 116 |
+
* `Guzzle\Plugin\Backoff\BackoffLogger` for formatting information.
|
| 117 |
+
*/
|
| 118 |
+
const BACKOFF_LOGGER_TEMPLATE = 'client.backoff.logger.template';
|
| 119 |
+
/**
|
| 120 |
+
* Set to true to use the bundled CA cert or pass the full path to an SSL
|
| 121 |
+
* certificate bundle. This option should be modified when you encounter
|
| 122 |
+
* curl error code 60. Set to "system" to use the cacert bundle on your
|
| 123 |
+
* system.
|
| 124 |
+
*/
|
| 125 |
+
const SSL_CERT = 'ssl.certificate_authority';
|
| 126 |
+
/**
|
| 127 |
+
* @var string Service description to use with the client
|
| 128 |
+
*/
|
| 129 |
+
const SERVICE_DESCRIPTION = 'service.description';
|
| 130 |
+
/**
|
| 131 |
+
* @var string Whether or not modeled responses have transformations applied to them
|
| 132 |
+
*/
|
| 133 |
+
const MODEL_PROCESSING = 'command.model_processing';
|
| 134 |
+
/**
|
| 135 |
+
* @var bool Set to false to disable validation
|
| 136 |
+
*/
|
| 137 |
+
const VALIDATION = 'validation';
|
| 138 |
+
/**
|
| 139 |
+
* @var string API version used by the client
|
| 140 |
+
*/
|
| 141 |
+
const VERSION = 'version';
|
| 142 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/DateFormat.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 20 |
+
/**
|
| 21 |
+
* Contains enumerable date format values used in the SDK
|
| 22 |
+
*/
|
| 23 |
+
class DateFormat extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
|
| 24 |
+
{
|
| 25 |
+
const ISO8601 = 'Ymd\\THis\\Z';
|
| 26 |
+
const ISO8601_S3 = 'Y-m-d\\TH:i:s\\Z';
|
| 27 |
+
const RFC1123 = 'D, d M Y H:i:s \\G\\M\\T';
|
| 28 |
+
const RFC2822 = \DateTime::RFC2822;
|
| 29 |
+
const SHORT = 'Ymd';
|
| 30 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Region.php
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 20 |
+
/**
|
| 21 |
+
* Contains enumerable region code values. These should be useful in most cases,
|
| 22 |
+
* with Amazon S3 being the most notable exception
|
| 23 |
+
*
|
| 24 |
+
* @link http://docs.aws.amazon.com/general/latest/gr/rande.html AWS Regions and Endpoints
|
| 25 |
+
*/
|
| 26 |
+
class Region extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
|
| 27 |
+
{
|
| 28 |
+
const US_EAST_1 = 'us-east-1';
|
| 29 |
+
const VIRGINIA = 'us-east-1';
|
| 30 |
+
const NORTHERN_VIRGINIA = 'us-east-1';
|
| 31 |
+
const US_WEST_1 = 'us-west-1';
|
| 32 |
+
const CALIFORNIA = 'us-west-1';
|
| 33 |
+
const NORTHERN_CALIFORNIA = 'us-west-1';
|
| 34 |
+
const US_WEST_2 = 'us-west-2';
|
| 35 |
+
const OREGON = 'us-west-2';
|
| 36 |
+
const EU_WEST_1 = 'eu-west-1';
|
| 37 |
+
const IRELAND = 'eu-west-1';
|
| 38 |
+
const EU_CENTRAL_1 = 'eu-central-1';
|
| 39 |
+
const FRANKFURT = 'eu-central-1';
|
| 40 |
+
const AP_SOUTHEAST_1 = 'ap-southeast-1';
|
| 41 |
+
const SINGAPORE = 'ap-southeast-1';
|
| 42 |
+
const AP_SOUTHEAST_2 = 'ap-southeast-2';
|
| 43 |
+
const SYDNEY = 'ap-southeast-2';
|
| 44 |
+
const AP_NORTHEAST_1 = 'ap-northeast-1';
|
| 45 |
+
const TOKYO = 'ap-northeast-1';
|
| 46 |
+
const SA_EAST_1 = 'sa-east-1';
|
| 47 |
+
const SAO_PAULO = 'sa-east-1';
|
| 48 |
+
const CN_NORTH_1 = 'cn-north-1';
|
| 49 |
+
const BEIJING = 'cn-north-1';
|
| 50 |
+
const US_GOV_WEST_1 = 'us-gov-west-1';
|
| 51 |
+
const GOV_CLOUD_US = 'us-gov-west-1';
|
| 52 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Size.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 20 |
+
/**
|
| 21 |
+
* Contains enumerable byte-size values
|
| 22 |
+
*/
|
| 23 |
+
class Size extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
|
| 24 |
+
{
|
| 25 |
+
const B = 1;
|
| 26 |
+
const BYTE = 1;
|
| 27 |
+
const BYTES = 1;
|
| 28 |
+
const KB = 1024;
|
| 29 |
+
const KILOBYTE = 1024;
|
| 30 |
+
const KILOBYTES = 1024;
|
| 31 |
+
const MB = 1048576;
|
| 32 |
+
const MEGABYTE = 1048576;
|
| 33 |
+
const MEGABYTES = 1048576;
|
| 34 |
+
const GB = 1073741824;
|
| 35 |
+
const GIGABYTE = 1073741824;
|
| 36 |
+
const GIGABYTES = 1073741824;
|
| 37 |
+
const TB = 1099511627776;
|
| 38 |
+
const TERABYTE = 1099511627776;
|
| 39 |
+
const TERABYTES = 1099511627776;
|
| 40 |
+
const PB = 1125899906842624;
|
| 41 |
+
const PETABYTE = 1125899906842624;
|
| 42 |
+
const PETABYTES = 1125899906842624;
|
| 43 |
+
const EB = 1152921504606846976;
|
| 44 |
+
const EXABYTE = 1152921504606846976;
|
| 45 |
+
const EXABYTES = 1152921504606846976;
|
| 46 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Time.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 20 |
+
/**
|
| 21 |
+
* Contains enumerable time values
|
| 22 |
+
*/
|
| 23 |
+
class Time extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
|
| 24 |
+
{
|
| 25 |
+
const SECOND = 1;
|
| 26 |
+
const SECONDS = 1;
|
| 27 |
+
const MINUTE = 60;
|
| 28 |
+
const MINUTES = 60;
|
| 29 |
+
const HOUR = 3600;
|
| 30 |
+
const HOURS = 3600;
|
| 31 |
+
const DAY = 86400;
|
| 32 |
+
const DAYS = 86400;
|
| 33 |
+
const WEEK = 604800;
|
| 34 |
+
const WEEKS = 604800;
|
| 35 |
+
const MONTH = 2592000;
|
| 36 |
+
const MONTHS = 2592000;
|
| 37 |
+
const YEAR = 31557600;
|
| 38 |
+
const YEARS = 31557600;
|
| 39 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/UaString.php
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
|
| 20 |
+
/**
|
| 21 |
+
* User-Agent header strings for various high level operations
|
| 22 |
+
*/
|
| 23 |
+
class UaString extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* @var string Name of the option used to add to the UA string
|
| 27 |
+
*/
|
| 28 |
+
const OPTION = 'ua.append';
|
| 29 |
+
/**
|
| 30 |
+
* @var string Resource iterator
|
| 31 |
+
*/
|
| 32 |
+
const ITERATOR = 'ITR';
|
| 33 |
+
/**
|
| 34 |
+
* @var string Resource waiter
|
| 35 |
+
*/
|
| 36 |
+
const WAITER = 'WTR';
|
| 37 |
+
/**
|
| 38 |
+
* @var string Session handlers (e.g. Amazon DynamoDB session handler)
|
| 39 |
+
*/
|
| 40 |
+
const SESSION = 'SES';
|
| 41 |
+
/**
|
| 42 |
+
* @var string Multipart upload helper for Amazon S3
|
| 43 |
+
*/
|
| 44 |
+
const MULTIPART_UPLOAD = 'MUP';
|
| 45 |
+
/**
|
| 46 |
+
* @var string Command executed during a batch transfer
|
| 47 |
+
*/
|
| 48 |
+
const BATCH = 'BAT';
|
| 49 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/AwsExceptionInterface.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* "Marker Interface" implemented by every exception in the AWS SDK
|
| 21 |
+
*/
|
| 22 |
+
interface AwsExceptionInterface
|
| 23 |
+
{
|
| 24 |
+
public function getCode();
|
| 25 |
+
public function getLine();
|
| 26 |
+
public function getFile();
|
| 27 |
+
public function getMessage();
|
| 28 |
+
public function getPrevious();
|
| 29 |
+
public function getTrace();
|
| 30 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/BadMethodCallException.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* AWS SDK namespaced version of the SPL BadMethodCallException.
|
| 21 |
+
*/
|
| 22 |
+
class BadMethodCallException extends \BadMethodCallException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
|
| 23 |
+
{
|
| 24 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/DomainException.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* AWS SDK namespaced version of the SPL DomainException.
|
| 21 |
+
*/
|
| 22 |
+
class DomainException extends \DomainException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
|
| 23 |
+
{
|
| 24 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionFactoryInterface.php
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
|
| 21 |
+
/**
|
| 22 |
+
* Interface used to create AWS exception
|
| 23 |
+
*/
|
| 24 |
+
interface ExceptionFactoryInterface
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Returns an AWS service specific exception
|
| 28 |
+
*
|
| 29 |
+
* @param RequestInterface $request Unsuccessful request
|
| 30 |
+
* @param Response $response Unsuccessful response that was encountered
|
| 31 |
+
*
|
| 32 |
+
* @return \Exception|AwsExceptionInterface
|
| 33 |
+
*/
|
| 34 |
+
public function fromResponse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response);
|
| 35 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionListener.php
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
|
| 20 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
| 21 |
+
/**
|
| 22 |
+
* Converts generic Guzzle response exceptions into AWS specific exceptions
|
| 23 |
+
*/
|
| 24 |
+
class ExceptionListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* @var ExceptionFactoryInterface Factory used to create new exceptions
|
| 28 |
+
*/
|
| 29 |
+
protected $factory;
|
| 30 |
+
/**
|
| 31 |
+
* @param ExceptionFactoryInterface $factory Factory used to create exceptions
|
| 32 |
+
*/
|
| 33 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionFactoryInterface $factory)
|
| 34 |
+
{
|
| 35 |
+
$this->factory = $factory;
|
| 36 |
+
}
|
| 37 |
+
/**
|
| 38 |
+
* {@inheritdoc}
|
| 39 |
+
*/
|
| 40 |
+
public static function getSubscribedEvents()
|
| 41 |
+
{
|
| 42 |
+
return array('request.error' => array('onRequestError', -1));
|
| 43 |
+
}
|
| 44 |
+
/**
|
| 45 |
+
* Throws a more meaningful request exception if available
|
| 46 |
+
*
|
| 47 |
+
* @param Event $event Event emitted
|
| 48 |
+
*/
|
| 49 |
+
public function onRequestError(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
|
| 50 |
+
{
|
| 51 |
+
$e = $this->factory->fromResponse($event['request'], $event['response']);
|
| 52 |
+
$event->stopPropagation();
|
| 53 |
+
throw $e;
|
| 54 |
+
}
|
| 55 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InstanceProfileCredentialsException.php
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
|
| 20 |
+
/**
|
| 21 |
+
* Exception thrown when an error occurs with instance profile credentials
|
| 22 |
+
*/
|
| 23 |
+
class InstanceProfileCredentialsException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* @var string
|
| 27 |
+
*/
|
| 28 |
+
protected $statusCode;
|
| 29 |
+
/**
|
| 30 |
+
* Set the error response code received from the instance metadata
|
| 31 |
+
*
|
| 32 |
+
* @param string $code Response code
|
| 33 |
+
*/
|
| 34 |
+
public function setStatusCode($code)
|
| 35 |
+
{
|
| 36 |
+
$this->statusCode = $code;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Get the error response code from the service
|
| 40 |
+
*
|
| 41 |
+
* @return string|null
|
| 42 |
+
*/
|
| 43 |
+
public function getStatusCode()
|
| 44 |
+
{
|
| 45 |
+
return $this->statusCode;
|
| 46 |
+
}
|
| 47 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InvalidArgumentException.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* AWS SDK namespaced version of the SPL InvalidArgumentException.
|
| 21 |
+
*/
|
| 22 |
+
class InvalidArgumentException extends \InvalidArgumentException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
|
| 23 |
+
{
|
| 24 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/LogicException.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* AWS SDK namespaced version of the SPL LogicException.
|
| 21 |
+
*/
|
| 22 |
+
class LogicException extends \LogicException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
|
| 23 |
+
{
|
| 24 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/MultipartUploadException.php
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
| 7 |
+
* You may not use this file except in compliance with the License.
|
| 8 |
+
* A copy of the License is located at
|
| 9 |
+
*
|
| 10 |
+
* http://aws.amazon.com/apache2.0
|
| 11 |
+
*
|
| 12 |
+
* or in the "license" file accompanying this file. This file is distributed
|
| 13 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
| 14 |
+
* express or implied. See the License for the specific language governing
|
| 15 |
+
* permissions and limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
|
| 18 |
+
|
| 19 |
+
use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferStateInterface;
|
| 20 |
+
/**
|
| 21 |
+
* Thrown when a {@see Aws\Common\MultipartUpload\TransferInterface} object encounters an error during transfer
|
| 22 |
+
*/
|
| 23 |
+
class MultipartUploadException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* @var TransferStateInterface State of the transfer when the error was encountered
|
| 27 |
+
*/
|
| 28 |
+
protected $state;
|
| 29 |
+
/**
|
| 30 |
+
* @param TransferStateInterface $state Transfer state
|
| 31 |
+
* @param \Exception $exception Last encountered exception
|
| 32 |
+
*/
|
| 33 |
+
public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferStateInterface $state, \Exception $exception = null)
|
| 34 |
+
{
|
| 35 |
+
parent::__construct('An error was encountered while performing a multipart upload: ' . $exception->getMessage(), 0, $exception);
|
| 36 |
+
$this->state = $state;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Get the state of the transfer
|
| 40 |
+
*
|
| 41 |
+
* @return TransferStateInterface
|
| 42 |
+
*/
|
| 43 |
+
public function getState()
|
| 44 |
+
{
|
| 45 |
+
return $this->state;
|
| 46 |
+
}
|
| 47 |
+
}
|
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
