Permalink
Browse files

Added filter to the get_attachment_url function.

  • Loading branch information...
bradt committed Sep 9, 2012
1 parent e777cd4 commit bbe1aed5c2ae900e9ba1b16ba6806c28ab8e2f1c
Showing with 16 additions and 6 deletions.
  1. +16 −6 wordpress-s3/class-plugin-public.php
@@ -19,11 +19,21 @@ function wp_get_attachment_url($url, $postID) {
if (!$this->options) $this->options = get_option('tantan_wordpress_s3');
if ($this->options['wp-uploads'] && ($amazon = get_post_meta($postID, 'amazonS3_info', true))) {
$accessDomain = ($this->options['cloudfront'] != '' ? $this->options['cloudfront'] : ($this->options['virtual-host'] ? $amazon['bucket'] : $amazon['bucket'].'.s3.amazonaws.com'));
return 'http://'.$accessDomain.'/'.$amazon['key'];
} else {
return $url;
}
if ( isset($this->options['cloudfront']) && $this->options['cloudfront'] ) {
$accessDomain = $this->options['cloudfront'];
}
elseif ( isset($this->options['virtual-host']) && $this->options['virtual-host'] ) {
$accessDomain = $this->options['bucket'];
}
else {
$accessDomain = $amazon['bucket'] . '.s3.amazonaws.com';
}
$url = 'https://'.$accessDomain.'/'.$amazon['key'];
$url = apply_filters( 'wps3_get_attachment_url', $url, $postID, $this );
}
return $url;
}
}
?>

0 comments on commit bbe1aed

Please sign in to comment.