PHP Class S3_Uploads

Afficher le fichier Open project: humanmade/s3-uploads Class Usage Examples

Méthodes publiques

Свойство Type Description
$original_upload_dir

Méthodes publiques

Méthode Description
__construct ( $bucket, $key, $secret, $bucket_url = null, $region = null )
copy_image_from_s3 ( string $file ) : string Get a local copy of the file.
filter_editors ( $editors )
filter_sideload_move_temp_file_to_s3 ( array $file ) : array Copy the file from /tmp to an s3 dir so handle_sideload doesn't fail due to trying to do a rename() on the file cross streams. This is somewhat of a hack to work around the core issue https://core.trac.wordpress.org/ticket/29257
filter_upload_dir ( $dirs )
get_instance ( ) : S3_Uploads
get_original_upload_dir ( )
get_s3_bucket ( ) : string Get the S3 bucket name
get_s3_bucket_region ( )
get_s3_url ( )
register_stream_wrapper ( ) Register the stream wrapper for s3
s3 ( ) : Aws\S3\S3Client
setup ( ) Setup the hooks, urls filtering etc for S3 Uploads
tear_down ( ) Tear down the hooks, url filtering etc for S3 Uploads
wp_filter_delete_file ( string $file_path ) : string When WordPress removes files, it's expecting to do so on absolute file paths, as such it breaks when using uris for file paths (such as s3://.
wp_filter_read_image_metadata ( array $meta, string $file ) : array | boolean Filters wp_read_image_metadata. exif_read_data() doesn't work on file streams so we need to make a temporary local copy to extract exif data from.

Method Details

__construct() public méthode

public __construct ( $bucket, $key, $secret, $bucket_url = null, $region = null )

copy_image_from_s3() public méthode

Get a local copy of the file.
public copy_image_from_s3 ( string $file ) : string
$file string
Résultat string

filter_editors() public méthode

public filter_editors ( $editors )

filter_sideload_move_temp_file_to_s3() public méthode

Copy the file from /tmp to an s3 dir so handle_sideload doesn't fail due to trying to do a rename() on the file cross streams. This is somewhat of a hack to work around the core issue https://core.trac.wordpress.org/ticket/29257
public filter_sideload_move_temp_file_to_s3 ( array $file ) : array
$file array
Résultat array

filter_upload_dir() public méthode

public filter_upload_dir ( $dirs )

get_instance() public static méthode

public static get_instance ( ) : S3_Uploads
Résultat S3_Uploads

get_original_upload_dir() public méthode

get_s3_bucket() public méthode

Get the S3 bucket name
public get_s3_bucket ( ) : string
Résultat string

get_s3_bucket_region() public méthode

get_s3_url() public méthode

public get_s3_url ( )

register_stream_wrapper() public méthode

Register the stream wrapper for s3

s3() public méthode

public s3 ( ) : Aws\S3\S3Client
Résultat Aws\S3\S3Client

setup() public méthode

Setup the hooks, urls filtering etc for S3 Uploads
public setup ( )

tear_down() public méthode

Tear down the hooks, url filtering etc for S3 Uploads
public tear_down ( )

wp_filter_delete_file() public méthode

..). We have to filter the file_path to only return the relative section, to play nice with WordPress handling.
public wp_filter_delete_file ( string $file_path ) : string
$file_path string
Résultat string

wp_filter_read_image_metadata() public méthode

Filters wp_read_image_metadata. exif_read_data() doesn't work on file streams so we need to make a temporary local copy to extract exif data from.
public wp_filter_read_image_metadata ( array $meta, string $file ) : array | boolean
$meta array
$file string
Résultat array | boolean

Property Details

$original_upload_dir public_oe property

public $original_upload_dir