Skip to content

Commit 8b55698

Browse files
committed
Minor changes to make it work with Google Cloud Storage instead
1 parent 87bd0a0 commit 8b55698

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: classes/amazon-s3-and-cloudfront.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
5555
const DEFAULT_ACL = 'public-read';
5656
const PRIVATE_ACL = 'private';
5757
const DEFAULT_EXPIRES = 900;
58-
const DEFAULT_REGION = 'us-east-1';
58+
const DEFAULT_REGION = 'global';
5959

6060
const SETTINGS_KEY = 'tantan_wordpress_s3';
6161

@@ -998,7 +998,7 @@ function get_file_prefix( $time = null, $post_id = null ) {
998998
* @return string
999999
*/
10001000
function get_s3_url_prefix( $region = '', $expires = null ) {
1001-
$prefix = 's3';
1001+
$prefix = 'storage';
10021002

10031003
if ( '' !== $region ) {
10041004
$delimiter = '-';
@@ -1046,10 +1046,10 @@ function get_s3_url_domain( $bucket, $region = '', $expires = null, $args = arra
10461046
$s3_domain = $bucket;
10471047
}
10481048
elseif ( 'path' === $args['domain'] || $this->use_ssl( $args['ssl'] ) ) {
1049-
$s3_domain = $prefix . '.amazonaws.com/' . $bucket;
1049+
$s3_domain = $prefix . '.googleapis.com/' . $bucket;
10501050
}
10511051
else {
1052-
$s3_domain = $bucket . '.' . $prefix . '.amazonaws.com';
1052+
$s3_domain = $bucket . '.' . $prefix . '.googleapis.com';
10531053
}
10541054

10551055
return $s3_domain;

Diff for: view/domain-setting.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
<label class="subdomain-wrap <?php echo $subdomain_class; // xss ok?>">
2222
<input type="radio" name="domain" value="subdomain" <?php checked( $domain, 'subdomain' ); ?> <?php echo $subdomain_disabled; // xss ok ?>>
2323
<?php _e( 'Bucket name as subdomain', 'amazon-s3-and-cloudfront' ); ?>
24-
<p>http://bucket-name.s3.amazon.com/&hellip;</p>
24+
<p>http://bucket-name.storage.googleapis.com/&hellip;</p>
2525
</label>
2626
<label>
2727
<input type="radio" name="domain" value="path" <?php checked( $domain, 'path' ); ?>>
2828
<?php _e( 'Bucket name in path', 'amazon-s3-and-cloudfront' ); ?>
29-
<p>http://s3.amazon.com/bucket-name/&hellip;</p>
29+
<p>http://storage.googleapis.com/bucket-name/&hellip;</p>
3030
</label>
3131
<label>
3232
<input type="radio" name="domain" value="virtual-host" <?php checked( $domain, 'virtual-host' ); ?>>

0 commit comments

Comments
 (0)