Loading inc/class-s3-uploads.php +15 −14 Original line number Diff line number Diff line Loading @@ -82,25 +82,26 @@ class S3_Uploads { } 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'] ); $new_basedir = 's3://' . $this->bucket; if ( defined( 'S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL' ) && S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL ) { $new_baseurl = $dirs['baseurl']; } else if ( defined( 'S3_UPLOADS_USE_LOCAL' ) && S3_UPLOADS_USE_LOCAL ) { $new_baseurl = $dirs['baseurl'] . '/s3/' . $this->bucket; } 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'] ); } $new_baseurl = $this->get_s3_url(); } return $dirs; return array( 'subdir' => $dirs['subdir'], 'path' => str_replace( $dirs['basedir'], $new_basedir, $dirs['path'] ), 'url' => str_replace( $dirs['baseurl'], $new_baseurl, $dirs['url'] ), 'basedir' => $new_basedir, 'baseurl' => $new_baseurl, 'error' => false, ); } /** Loading Loading
inc/class-s3-uploads.php +15 −14 Original line number Diff line number Diff line Loading @@ -82,25 +82,26 @@ class S3_Uploads { } 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'] ); $new_basedir = 's3://' . $this->bucket; if ( defined( 'S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL' ) && S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL ) { $new_baseurl = $dirs['baseurl']; } else if ( defined( 'S3_UPLOADS_USE_LOCAL' ) && S3_UPLOADS_USE_LOCAL ) { $new_baseurl = $dirs['baseurl'] . '/s3/' . $this->bucket; } 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'] ); } $new_baseurl = $this->get_s3_url(); } return $dirs; return array( 'subdir' => $dirs['subdir'], 'path' => str_replace( $dirs['basedir'], $new_basedir, $dirs['path'] ), 'url' => str_replace( $dirs['baseurl'], $new_baseurl, $dirs['url'] ), 'basedir' => $new_basedir, 'baseurl' => $new_baseurl, 'error' => false, ); } /** Loading