PHP Класс S3_Uploads

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$original_upload_dir

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

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

copy_image_from_s3() публичный Метод

Get a local copy of the file.
public copy_image_from_s3 ( string $file ) : string
$file string
Результат string

filter_editors() публичный Метод

public filter_editors ( $editors )

filter_sideload_move_temp_file_to_s3() публичный Метод

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
Результат array

filter_upload_dir() публичный Метод

public filter_upload_dir ( $dirs )

get_instance() публичный статический Метод

public static get_instance ( ) : S3_Uploads
Результат S3_Uploads

get_original_upload_dir() публичный Метод

get_s3_bucket() публичный Метод

Get the S3 bucket name
public get_s3_bucket ( ) : string
Результат string

get_s3_bucket_region() публичный Метод

get_s3_url() публичный Метод

public get_s3_url ( )

register_stream_wrapper() публичный Метод

Register the stream wrapper for s3

s3() публичный Метод

public s3 ( ) : Aws\S3\S3Client
Результат Aws\S3\S3Client

setup() публичный Метод

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

tear_down() публичный Метод

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

wp_filter_delete_file() публичный Метод

..). 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
Результат string

wp_filter_read_image_metadata() публичный Метод

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
Результат array | boolean

Описание свойств

$original_upload_dir публичное свойство

public $original_upload_dir