public function filter_upload_dir($dirs)
{
$this->original_upload_dir = $dirs;
$dirs['path'] = str_replace(WP_CONTENT_DIR, 's3://' . $this->bucket, $dirs['path']);
$dirs['basedir'] = str_replace(WP_CONTENT_DIR, 's3://' . $this->bucket, $dirs['basedir']);
if (!defined('S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL') || !S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL) {
if (defined('S3_UPLOADS_USE_LOCAL') && S3_UPLOADS_USE_LOCAL) {
$dirs['url'] = str_replace('s3://' . $this->bucket, $dirs['baseurl'] . '/s3/' . $this->bucket, $dirs['path']);
$dirs['baseurl'] = str_replace('s3://' . $this->bucket, $dirs['baseurl'] . '/s3/' . $this->bucket, $dirs['basedir']);
} else {
$dirs['url'] = str_replace('s3://' . $this->bucket, $this->get_s3_url(), $dirs['path']);
$dirs['baseurl'] = str_replace('s3://' . $this->bucket, $this->get_s3_url(), $dirs['basedir']);
}
}
return $dirs;
}