PHP 클래스 Amazon_S3_And_CloudFront, wp-amazon-s3-and-cloudfront

상속: extends AWS_Plugin_Base
파일 보기 프로젝트 열기: deliciousbrains/wp-amazon-s3-and-cloudfront 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$filter_local AS3CF_Local_To_S3
$filter_s3 AS3CF_S3_To_Local
$hook_suffix string
$notices AS3CF_Notices
$plugin_compat AS3CF_Plugin_Compatibility

보호된 프로퍼티들

프로퍼티 타입 설명
$admin_notices array
$buckets_check Store if each bucket, used by the plugin and addons, is writable
$default_tab string
$plugin_menu_title string
$plugin_page
$plugin_prefix string
$plugin_title string

공개 메소드들

메소드 설명
__construct ( string $plugin_file_path, Amazon_Web_Services $aws, string | null $slug = null )
_exit ( integer | string $exit_code ) : void Helper function for terminating script execution. Easily testable.
_throw_error ( string $code, string $message = '', mixed $data = '' ) : WP_Error Throw error
add_media_row_actions ( array $actions = [], WP_Post | integer $post ) : array Conditionally adds copy, remove and download S3 action links for an attachment on the Media library list view
admin_menu ( Amazon_Web_Services $aws ) Add the settings menu item
ajax_check_bucket ( )
ajax_create_bucket ( ) Handler for AJAX callback to create a bucket in S3
ajax_get_attachment_s3_details ( ) Handle retieving the S3 details for attachment modals.
ajax_get_buckets ( ) AJAX handler for get_buckets()
ajax_get_diagnostic_info ( ) AJAX handler for get_diagnostic_info()
ajax_get_url_preview ( ) AJAX handler for get_url_preview()
ajax_save_bucket ( ) Handler for AJAX callback to save the selection of a bucket
apply_file_suffix ( string $file, string $suffix ) : string Helper to apply a suffix to a file path
attachment_s3_actions_meta_box ( ) Render the S3 attachment meta box
attachment_s3_meta_box ( ) Add the S3 meta box to the attachment screen
check_for_gd_imagick ( ) Check if PHP GD and Imagick is installed
check_write_permission ( string $bucket = null, string $region = null ) : boolean | WP_Error Checks the user has write permission for S3
clear_scheduled_event ( string $hook ) Wrapper for clearing scheduled events for a specific cron job
count_attachments ( string $prefix, null | boolean $uploaded_to_s3 = null ) : integer Count attachments on a site
create_bucket ( string $bucket_name, null | string $region = null ) : boolean | WP_Error Create an S3 bucket
dbrains_link ( string $url, string $text, string $hash = '', boolean $append_campaign = true ) : string Create a site link for given url, link text and optional anchor, usually with campaign.
decode_filename_in_path ( string $file ) : string Decode file name.
delete_attachment ( integer $post_id, boolean $force_new_s3_client = false ) Removes an attachment and intermediate image size files from S3
delete_s3_objects ( string $region, string $bucket, array $objects, boolean $log_error = false, boolean $return_on_error = false, boolean $force_new_s3_client = false ) : boolean Delete bulk objects from an S3 bucket
does_file_exist ( string $filename, string $time ) : boolean Does file exist
does_file_exist_local ( string $filename, string $time ) : boolean Does file exist local
does_file_exist_s3 ( string $filename, string $time ) : boolean Does file exist s3
encode_filename_in_path ( string $file ) : string Encode file names according to RFC 3986 when generating urls As per Amazon https://forums.aws.amazon.com/thread.jspa?threadID=55746#jive-message-244233
end_ajax ( array $return = [] ) Helper method for returning data to AJAX call
filter_input ( string $variable, integer $type = INPUT_GET, integer $filter = FILTER_DEFAULT, mixed $options = [] ) : mixed Helper function for filtering super globals. Easily testable.
filter_settings ( array $settings ) : array Filter in defined settings with sensible defaults.
gd_enabled ( ) : boolean Detect if PHP GD is enabled
generate_unique_filename ( string $name, string $ext, string $time ) : string Generate unique filename
get_access_denied_notice_message ( boolean $single = true ) : string Get the access denied bucket error notice message
get_acl_display_name ( string $acl ) : string Return human friendly ACL name
get_all_blog_table_prefixes ( array $exclude_blog_ids = [] ) : array Get all the table prefixes for the blogs in the site. MS compatible
get_allowed_mime_types ( ) : array Allowed mime types array that can be edited for specific S3 uploading
get_attached_file ( string $file, integer $attachment_id ) : string Return the S3 URL when the local file is missing unless we know the calling process is and we are happy to copy the file back to the server to be used
get_attachment_file_paths ( integer $attachment_id, boolean $exists_locally = true, array | boolean $meta = false, boolean $include_backups = true ) : array Get file paths for all attachment versions.
get_attachment_folder_time ( integer $post_id ) : integer | string Get the time of attachment upload.
get_attachment_local_url ( integer $post_id ) : string | false Get attachment local URL.
get_attachment_local_url_size ( integer $post_id, string | null $size = null ) : false | string Get attachment local URL size.
get_attachment_s3_info ( integer $post_id ) : mixed Get attachment s3 info
get_attachment_s3_url ( integer $post_id, array $s3object, null | integer $expires = null, null | string | array $size = null, null | array $meta = null, array $headers = [] ) : mixed | WP_Error Get the S3 URL for an attachment
get_attachment_url ( integer $post_id, integer | null $expires = null, string | null $size = null, array | null $meta = null, array $headers = [], boolean $skip_rewrite_check = false ) : boolean | mixed | void | WP_Error Get the url of the file from Amazon S3
get_aws_bucket_link ( string $bucket = '', string $prefix = '' ) : string Get the link to the bucket on the AWS console
get_aws_regions ( ) : array Get all AWS regions
get_blog_ids ( ) : false | array Get all the blog IDs for the multisite network used for table prefixes
get_bucket_region ( string $bucket ) : string | WP_Error Get the region of a bucket
get_buckets ( ) : array | WP_Error Get a list of buckets from S3
get_default_object_prefix ( ) : string Return the default object prefix
get_dynamic_prefix ( string $time = null ) : string Get the prefix path for the files. Ignores WP media library year month subdirectory setting and just uses S3 setting
get_file_prefix ( null | string $time = null ) : string Get the file prefix
get_folder_time_from_url ( string $url ) : null | string Get the upload folder time from given URL
get_formatted_s3_info ( integer $id, array | null $s3object = null ) : array Return a formatted S3 info with display friendly defaults
get_image_sizes_details ( ) : string Output image size names and dimensions to a string
get_media_action_strings ( null | string $string = null ) : array | string Get all strings or a specific string used for the media actions
get_memory_limit ( ) : integer Get memory limit
get_object_prefix ( string $toggle_setting = 'enable-object-prefix' ) : string Get the custom object prefix if enabled
get_object_version_string ( ) : string Get the object versioning string prefix
get_plugin_details ( string $plugin_path, string $suffix = '' ) : string Helper to display plugin details
get_plugin_page_title ( ) : string Get the plugin title to be used in page headings
get_plugin_page_url ( array $args = [], string $url_method = 'network', boolean $escape = true ) : string Helper method to return the settings page URL for the plugin
get_plugin_prefix_slug ( ) : string Get the plugin prefix in slug format, ie. replace underscores with hyphens
get_post_time ( integer $post_id ) : string Get post time
get_s3_url_domain ( string $bucket, string $region = '', integer $expires = null, array $args = [], boolean $preview = false ) : mixed | string | void Get the S3 url for the files
get_s3_url_prefix ( string $region = '', null | integer $expires = null ) : string Get the region specific prefix for S3 URL
get_s3_url_scheme ( boolean | null $use_ssl = null ) : string Return the scheme to be used in URLs
get_s3client ( boolean | string $region = false, boolean $force = false ) : Aws\S3\S3Client Get the S3 client
get_s3object_region ( array $s3object, integer $post_id = null ) : string | WP_Error Get the region of the bucket stored in the S3 metadata.
get_secure_attachment_url ( integer $post_id, integer | null $expires = null, string | null $size = null, array $headers = [], boolean $skip_rewrite_check = false ) : mixed | void | WP_Error Generate a link to download a file from Amazon S3 using query string authentication. This link is only valid for a limited amount of time.
get_setting ( string $key, mixed $default = '' ) : integer | mixed | string | WP_Error Accessor for a plugin setting with conditions to defaults and upgrades
get_setting_args ( string $key ) : array Gets arguements used to render a setting view.
get_setting_bucket ( string $key, string $value, string $constant = 'AS3CF_BUCKET' ) : string | false Get the bucket and if a constant save to database and clear region
get_setting_region ( array $settings, string $key, mixed $default ) : boolean | string | WP_Error Get the region setting
get_settings_nonce_key ( ) : string Get the nonce key for the settings form of the plugin
get_settings_tabs ( ) : array Get the tabs available for the plugin settings page
get_settings_whitelist ( ) : array Whitelist of settings allowed to be saved
get_skip_sanitize_settings ( ) : array List of settings that should skip full sanitize.
get_url_preview ( boolean $escape = true, string $suffix = 'photo.jpg' ) : string Generate a preview of the URL of files uploaded to S3
get_year_month_directory_name ( string $time = null ) : string Generate the year and month sub-directory from $time if provided, then POST time if available, otherwise use current time
handle_post_request ( ) Handle the saving of the settings page
http_prepare_download_log ( ) : void Check for as3cf-download-log and related nonce and if found begin the download of the diagnostic log
imagick_enabled ( ) : boolean Detect is Imagick is enabled
init ( string $plugin_file_path ) Abstract class constructor
is_attachment_served_by_s3 ( integer $attachment_id, boolean $skip_rewrite_check = false ) : boolean | array Is attachment served by S3.
is_current_blog ( integer $blog_id ) : boolean Is the current blog ID that specified in wp-config.php
is_plugin_setup ( ) : boolean Check the plugin is correctly setup
is_pro ( ) : boolean Check whether the pro addon is installed.
load_attachment_assets ( $hook_suffix ) Load the attachment assets only when editing an attachment
load_media_assets ( ) Load media assets.
make_acl_admin_notice ( array $s3object ) Make admin notice for when object ACL has changed
maybe_disable_save_button ( string $defined_settings = [] ) : string Disables the save button if all settings have been defined.
maybe_encode_get_image_tag ( string $html, integer $id, string $alt, string $title, string $align, string $size ) : string Maybe encode attachment URLs when retrieving the image tag
maybe_encode_image_get_intermediate_size ( array $data, integer $post_id, string | array $size ) : array Maybe encode URLs when retrieving intermediate sizes.
maybe_encode_wp_get_attachment_image_src ( array | boolean $image, integer $attachment_id, string | array $size, boolean $icon ) : array Maybe encode URLs for images that represent an attachment
maybe_encode_wp_prepare_attachment_for_js ( array $response, integer | object $attachment, array $meta ) : array Maybe encode URLs when outputting attachments in the media grid
maybe_remove_query_string ( string $url ) : string Maybe remove query string from URL.
maybe_update_cloudfront_path ( string $path ) : string Potentially update path for CloudFront URLs.
memory_exceeded ( null | string $filter_name = null ) : boolean Memory exceeded
more_info_link ( string $url, string $hash = '', boolean $append_campaign = true ) : string More info link
multisite_get_spaced_used ( $space_used ) : float | integer Used to give a realistic total of storage space used on a Multisite subsite, when there have been attachments uploaded to S3 but removed from server
on_off ( string $key ) : string Helper for displaying settings
open_ssl_enabled ( ) : boolean Detect if OpenSSL is enabled
output_diagnostic_info ( boolean $escape = true ) : string Diagnostic information for the support tab
plugin_deactivated_notice ( ) Display a notice after either lite or pro plugin has been auto deactivated
plugin_load ( )
pre_set_setting ( string $key, string $value ) Perform custom actions before the setting is saved
prepare_bucket_error ( WP_Error $object, boolean $single = true ) : array Prepare the bucket error before returning to JS
register_modal_assets ( ) Register modal scripts and styles so they can be enqueued later
remove_attachment_files_from_s3 ( integer $post_id, array $s3object, boolean $remove_backup_sizes = true, boolean $log_error = false, boolean $return_on_error = false, boolean $force_new_s3_client = false ) Removes an attachment's files from S3.
remove_local_files ( array $file_paths ) Remove files from the local site
remove_scheme ( string $url ) : string Remove scheme from URL.
remove_size_from_filename ( string $url, boolean $remove_extension = false ) : string Remove size from filename (image[-100x100].jpeg).
remove_wp_plugin_dir ( string $path ) : string Helper to remove the plugin directory from the plugin path
render_bucket_permission_errors ( ) Render error messages in a view for bucket permission and access issues
render_page ( ) Display the main settings page for the plugin
restore_current_blog ( ) Helper to restore to the current Multisite blog
sanitize_custom_domain ( string $domain ) : string Sanitize custom domain
save_bucket ( string $bucket_name, boolean $manual = false, null | string $region = null ) : string | boolean Save bucket and bucket's region
save_bucket_for_ajax ( string $bucket, boolean | false $manual_select = false, null | string $region = null, array $defaults = [] ) Wrapper method for saving a bucket when creating or selecting
schedule_event ( string $hook, null | string $interval = null, array $args = [] ) Wrapper for scheduling cron jobs
set_attachment_acl_on_s3 ( integer $post_id, array $s3object, string $acl ) : array | boolean | WP_Error Apply ACL to an attachment and associated files
set_client ( Aws\S3\S3Client $client ) Setter for S3 client
set_setting ( string $key, mixed $value ) Setter for a plugin setting with custom hooks
settings_more_info_link ( string $hash ) : string Settings more info link
show_deprecated_domain_setting ( null | string $domain = null ) : boolean Show the deprecated Domain option setting?
switch_to_blog ( integer | boolean $blog_id = false ) Helper to switch to a Multisite blog - If the site is MS - If the blog is not the current blog defined
translate_region ( $region ) : string Translate older bucket locations to newer S3 region names http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
update_attached_file ( string $file, integer $attachment_id ) : string Allow processes to update the file on S3 via update_attached_file()
update_site_option ( string $option, mixed $value, boolean $autoload = true ) : boolean Update site option.
upgrade_virtual_host ( ) : string Upgrade the 'virtual host' / 'bucket as domain' setting to the new CloudFront / Domain setting
upload_attachment_to_s3 ( integer $post_id, array | null $data = null, string | null $file_path = null, boolean $force_new_s3_client = false, boolean $remove_local_files = true ) : array | WP_Error Upload attachment to S3
use_ssl ( boolean | null $use_ssl = null ) : boolean Determine when to use https in URLS
verify_ajax_request ( )
verify_media_actions ( ) : boolean Check we can do the media actions
wp_get_attachment_url ( string $url, integer $post_id ) : boolean | mixed | void | WP_Error Get attachment url
wp_handle_upload_prefilter ( array $file ) : array Create unique names for file to be uploaded to AWS This only applies when the remove local file option is enabled
wp_update_attachment_metadata ( array $data, integer $post_id ) : array Handles the upload of the attachment to S3 when an attachment is updated using the 'wp_update_attachment_metadata' filter

보호된 메소드들

메소드 설명
convert_dimensions_to_size_name ( integer $attachment_id, array $dimensions ) : null | string Convert dimensions to size
diagnostic_media_counts ( ) : array Get the total attachment and total S3 attachment counts for the diagnostic log
get_acl_value_string ( array $acl ) : string Get ACL value string.
get_local_url_preview ( boolean $escape = true, string $suffix = 'photo.jpg' ) : string Get local URL preview.
get_mime_types_to_gzip ( boolean $media_library = false ) : array Get mime types to gzip
maybe_convert_size_to_string ( integer $attachment_id, mixed $size ) : null | string Maybe convert size to string
maybe_display_deprecated_http_notice ( ) Display a notice if using setting to force HTTP as url scheme, removed in 1.3.
maybe_sign_intermediate_size ( string $url, integer $attachment_id, string | array $size, boolean | array $s3object = false ) : mixed | WP_Error Sign intermediate size.
normalize_object_prefix ( string $prefix ) : string Normalize object prefix.
return_upload_error ( string $error_msg, array | null $return = null ) : array | WP_Error Helper to return meta data on upload error
should_gzip_file ( string $file_path, string $type ) : boolean Should gzip file

비공개 메소드들

메소드 설명
more_info_campaign_url ( string $url ) : string Create a More Info campaign url for given url.

메소드 상세

__construct() 공개 메소드

public __construct ( string $plugin_file_path, Amazon_Web_Services $aws, string | null $slug = null )
$plugin_file_path string
$aws Amazon_Web_Services
$slug string | null

_exit() 공개 메소드

Helper function for terminating script execution. Easily testable.
public _exit ( integer | string $exit_code ) : void
$exit_code integer | string
리턴 void

_throw_error() 공개 메소드

Throw error
public _throw_error ( string $code, string $message = '', mixed $data = '' ) : WP_Error
$code string
$message string
$data mixed
리턴 WP_Error

add_media_row_actions() 공개 메소드

Conditionally adds copy, remove and download S3 action links for an attachment on the Media library list view
public add_media_row_actions ( array $actions = [], WP_Post | integer $post ) : array
$actions array
$post WP_Post | integer
리턴 array

admin_menu() 공개 메소드

Add the settings menu item
public admin_menu ( Amazon_Web_Services $aws )
$aws Amazon_Web_Services

ajax_check_bucket() 공개 메소드

public ajax_check_bucket ( )

ajax_create_bucket() 공개 메소드

Handler for AJAX callback to create a bucket in S3
public ajax_create_bucket ( )

ajax_get_attachment_s3_details() 공개 메소드

Handle retieving the S3 details for attachment modals.

ajax_get_buckets() 공개 메소드

AJAX handler for get_buckets()
public ajax_get_buckets ( )

ajax_get_diagnostic_info() 공개 메소드

AJAX handler for get_diagnostic_info()

ajax_get_url_preview() 공개 메소드

AJAX handler for get_url_preview()

ajax_save_bucket() 공개 메소드

Handler for AJAX callback to save the selection of a bucket
public ajax_save_bucket ( )

apply_file_suffix() 공개 메소드

Helper to apply a suffix to a file path
public apply_file_suffix ( string $file, string $suffix ) : string
$file string
$suffix string
리턴 string

attachment_s3_actions_meta_box() 공개 메소드

Render the S3 attachment meta box

attachment_s3_meta_box() 공개 메소드

Add the S3 meta box to the attachment screen

check_for_gd_imagick() 공개 메소드

Check if PHP GD and Imagick is installed

check_write_permission() 공개 메소드

Checks the user has write permission for S3
public check_write_permission ( string $bucket = null, string $region = null ) : boolean | WP_Error
$bucket string
$region string
리턴 boolean | WP_Error

clear_scheduled_event() 공개 메소드

Wrapper for clearing scheduled events for a specific cron job
public clear_scheduled_event ( string $hook )
$hook string

convert_dimensions_to_size_name() 보호된 메소드

Convert dimensions to size
protected convert_dimensions_to_size_name ( integer $attachment_id, array $dimensions ) : null | string
$attachment_id integer
$dimensions array
리턴 null | string

count_attachments() 공개 메소드

Count attachments on a site
public count_attachments ( string $prefix, null | boolean $uploaded_to_s3 = null ) : integer
$prefix string
$uploaded_to_s3 null | boolean null - All attachments true - Attachments only uploaded to S3 false - Attachments not uploaded to S3
리턴 integer

create_bucket() 공개 메소드

Create an S3 bucket
public create_bucket ( string $bucket_name, null | string $region = null ) : boolean | WP_Error
$bucket_name string
$region null | string option location constraint
리턴 boolean | WP_Error

decode_filename_in_path() 공개 메소드

Decode file name.
public decode_filename_in_path ( string $file ) : string
$file string
리턴 string

delete_attachment() 공개 메소드

Removes an attachment and intermediate image size files from S3
public delete_attachment ( integer $post_id, boolean $force_new_s3_client = false )
$post_id integer
$force_new_s3_client boolean if we are deleting in bulk, force new S3 client to cope with possible different regions

delete_s3_objects() 공개 메소드

Delete bulk objects from an S3 bucket
public delete_s3_objects ( string $region, string $bucket, array $objects, boolean $log_error = false, boolean $return_on_error = false, boolean $force_new_s3_client = false ) : boolean
$region string
$bucket string
$objects array
$log_error boolean
$return_on_error boolean
$force_new_s3_client boolean if we are deleting in bulk, force new S3 client to cope with possible different regions
리턴 boolean

diagnostic_media_counts() 보호된 메소드

Get the total attachment and total S3 attachment counts for the diagnostic log
protected diagnostic_media_counts ( ) : array
리턴 array

does_file_exist() 공개 메소드

Does file exist
public does_file_exist ( string $filename, string $time ) : boolean
$filename string
$time string
리턴 boolean

does_file_exist_local() 공개 메소드

Does file exist local
public does_file_exist_local ( string $filename, string $time ) : boolean
$filename string
$time string
리턴 boolean

does_file_exist_s3() 공개 메소드

Does file exist s3
public does_file_exist_s3 ( string $filename, string $time ) : boolean
$filename string
$time string
리턴 boolean

encode_filename_in_path() 공개 메소드

Encode file names according to RFC 3986 when generating urls As per Amazon https://forums.aws.amazon.com/thread.jspa?threadID=55746#jive-message-244233
public encode_filename_in_path ( string $file ) : string
$file string
리턴 string Encoded filename

end_ajax() 공개 메소드

Helper method for returning data to AJAX call
public end_ajax ( array $return = [] )
$return array

filter_input() 공개 메소드

Helper function for filtering super globals. Easily testable.
public filter_input ( string $variable, integer $type = INPUT_GET, integer $filter = FILTER_DEFAULT, mixed $options = [] ) : mixed
$variable string
$type integer
$filter integer
$options mixed
리턴 mixed

filter_settings() 공개 메소드

Filter in defined settings with sensible defaults.
public filter_settings ( array $settings ) : array
$settings array
리턴 array $settings

gd_enabled() 공개 메소드

Detect if PHP GD is enabled
public gd_enabled ( ) : boolean
리턴 boolean

generate_unique_filename() 공개 메소드

Generate unique filename
public generate_unique_filename ( string $name, string $ext, string $time ) : string
$name string
$ext string
$time string
리턴 string

get_access_denied_notice_message() 공개 메소드

Get the access denied bucket error notice message
public get_access_denied_notice_message ( boolean $single = true ) : string
$single boolean
리턴 string

get_acl_display_name() 공개 메소드

Return human friendly ACL name
public get_acl_display_name ( string $acl ) : string
$acl string
리턴 string

get_acl_value_string() 보호된 메소드

Get ACL value string.
protected get_acl_value_string ( array $acl ) : string
$acl array
리턴 string

get_all_blog_table_prefixes() 공개 메소드

Get all the table prefixes for the blogs in the site. MS compatible
public get_all_blog_table_prefixes ( array $exclude_blog_ids = [] ) : array
$exclude_blog_ids array blog ids to exclude
리턴 array associative array with blog ID as key, prefix as value

get_allowed_mime_types() 공개 메소드

Allowed mime types array that can be edited for specific S3 uploading
public get_allowed_mime_types ( ) : array
리턴 array

get_attached_file() 공개 메소드

Return the S3 URL when the local file is missing unless we know the calling process is and we are happy to copy the file back to the server to be used
public get_attached_file ( string $file, integer $attachment_id ) : string
$file string
$attachment_id integer
리턴 string

get_attachment_file_paths() 공개 메소드

Get file paths for all attachment versions.
public get_attachment_file_paths ( integer $attachment_id, boolean $exists_locally = true, array | boolean $meta = false, boolean $include_backups = true ) : array
$attachment_id integer
$exists_locally boolean
$meta array | boolean
$include_backups boolean
리턴 array

get_attachment_folder_time() 공개 메소드

Use post datetime if attached.
public get_attachment_folder_time ( integer $post_id ) : integer | string
$post_id integer
리턴 integer | string

get_attachment_local_url() 공개 메소드

This is a direct copy of wp_get_attachment_url() from /wp-includes/post.php as we filter the URL in AS3CF and can't remove this filter using the current implementation of globals for class instances.
public get_attachment_local_url ( integer $post_id ) : string | false
$post_id integer
리턴 string | false Attachment URL, otherwise false.

get_attachment_local_url_size() 공개 메소드

Get attachment local URL size.
public get_attachment_local_url_size ( integer $post_id, string | null $size = null ) : false | string
$post_id integer
$size string | null
리턴 false | string

get_attachment_s3_info() 공개 메소드

Get attachment s3 info
public get_attachment_s3_info ( integer $post_id ) : mixed
$post_id integer
리턴 mixed

get_attachment_s3_url() 공개 메소드

Get the S3 URL for an attachment
public get_attachment_s3_url ( integer $post_id, array $s3object, null | integer $expires = null, null | string | array $size = null, null | array $meta = null, array $headers = [] ) : mixed | WP_Error
$post_id integer
$s3object array
$expires null | integer
$size null | string | array
$meta null | array
$headers array
리턴 mixed | WP_Error

get_attachment_url() 공개 메소드

Get the url of the file from Amazon S3
public get_attachment_url ( integer $post_id, integer | null $expires = null, string | null $size = null, array | null $meta = null, array $headers = [], boolean $skip_rewrite_check = false ) : boolean | mixed | void | WP_Error
$post_id integer Post ID of the attachment
$expires integer | null Seconds for the link to live
$size string | null Size of the image to get
$meta array | null Pre retrieved _wp_attachment_metadata for the attachment
$headers array Header overrides for request
$skip_rewrite_check boolean Always return the URL regardless of the 'Rewrite File URLs' setting. Useful for the EDD and Woo addons to not break download URLs when the option is disabled.
리턴 boolean | mixed | void | WP_Error

get_aws_regions() 공개 메소드

Get all AWS regions
public get_aws_regions ( ) : array
리턴 array

get_blog_ids() 공개 메소드

Get all the blog IDs for the multisite network used for table prefixes
public get_blog_ids ( ) : false | array
리턴 false | array

get_bucket_region() 공개 메소드

Get the region of a bucket
public get_bucket_region ( string $bucket ) : string | WP_Error
$bucket string
리턴 string | WP_Error

get_buckets() 공개 메소드

Get a list of buckets from S3
public get_buckets ( ) : array | WP_Error
리턴 array | WP_Error - list of buckets

get_default_object_prefix() 공개 메소드

Return the default object prefix

get_dynamic_prefix() 공개 메소드

Get the prefix path for the files. Ignores WP media library year month subdirectory setting and just uses S3 setting
public get_dynamic_prefix ( string $time = null ) : string
$time string
리턴 string

get_file_prefix() 공개 메소드

Get the file prefix
public get_file_prefix ( null | string $time = null ) : string
$time null | string
리턴 string

get_folder_time_from_url() 공개 메소드

Get the upload folder time from given URL
public get_folder_time_from_url ( string $url ) : null | string
$url string
리턴 null | string

get_formatted_s3_info() 공개 메소드

Return a formatted S3 info with display friendly defaults
public get_formatted_s3_info ( integer $id, array | null $s3object = null ) : array
$id integer
$s3object array | null
리턴 array

get_image_sizes_details() 공개 메소드

Output image size names and dimensions to a string
public get_image_sizes_details ( ) : string
리턴 string

get_local_url_preview() 보호된 메소드

Get local URL preview.
protected get_local_url_preview ( boolean $escape = true, string $suffix = 'photo.jpg' ) : string
$escape boolean
$suffix string
리턴 string

get_media_action_strings() 공개 메소드

Get all strings or a specific string used for the media actions
public get_media_action_strings ( null | string $string = null ) : array | string
$string null | string
리턴 array | string

get_memory_limit() 공개 메소드

Get memory limit
public get_memory_limit ( ) : integer
리턴 integer

get_mime_types_to_gzip() 보호된 메소드

Get mime types to gzip
protected get_mime_types_to_gzip ( boolean $media_library = false ) : array
$media_library boolean
리턴 array

get_object_prefix() 공개 메소드

Get the custom object prefix if enabled
public get_object_prefix ( string $toggle_setting = 'enable-object-prefix' ) : string
$toggle_setting string
리턴 string

get_object_version_string() 공개 메소드

Get the object versioning string prefix

get_plugin_details() 공개 메소드

Helper to display plugin details
public get_plugin_details ( string $plugin_path, string $suffix = '' ) : string
$plugin_path string
$suffix string
리턴 string

get_plugin_page_title() 공개 메소드

Get the plugin title to be used in page headings
public get_plugin_page_title ( ) : string
리턴 string

get_plugin_page_url() 공개 메소드

Helper method to return the settings page URL for the plugin
public get_plugin_page_url ( array $args = [], string $url_method = 'network', boolean $escape = true ) : string
$args array
$url_method string To prepend to admin_url()
$escape boolean Should we escape the URL
리턴 string

get_plugin_prefix_slug() 공개 메소드

Get the plugin prefix in slug format, ie. replace underscores with hyphens
public get_plugin_prefix_slug ( ) : string
리턴 string

get_post_time() 공개 메소드

Get post time
public get_post_time ( integer $post_id ) : string
$post_id integer
리턴 string

get_s3_url_domain() 공개 메소드

Get the S3 url for the files
public get_s3_url_domain ( string $bucket, string $region = '', integer $expires = null, array $args = [], boolean $preview = false ) : mixed | string | void
$bucket string
$region string
$expires integer
$args array Allows you to specify custom URL settings
$preview boolean When generating the URL preview sanitize certain output
리턴 mixed | string | void

get_s3_url_prefix() 공개 메소드

Get the region specific prefix for S3 URL
public get_s3_url_prefix ( string $region = '', null | integer $expires = null ) : string
$region string
$expires null | integer
리턴 string

get_s3_url_scheme() 공개 메소드

Return the scheme to be used in URLs
public get_s3_url_scheme ( boolean | null $use_ssl = null ) : string
$use_ssl boolean | null
리턴 string

get_s3client() 공개 메소드

Get the S3 client
public get_s3client ( boolean | string $region = false, boolean $force = false ) : Aws\S3\S3Client
$region boolean | string specify region to client for signature
$force boolean force return of new S3 client when swapping regions
리턴 Aws\S3\S3Client

get_s3object_region() 공개 메소드

Get the region of the bucket stored in the S3 metadata.
public get_s3object_region ( array $s3object, integer $post_id = null ) : string | WP_Error
$s3object array
$post_id integer - if supplied will update the s3 meta if no region found
리턴 string | WP_Error - region name

get_secure_attachment_url() 공개 메소드

Generate a link to download a file from Amazon S3 using query string authentication. This link is only valid for a limited amount of time.
public get_secure_attachment_url ( integer $post_id, integer | null $expires = null, string | null $size = null, array $headers = [], boolean $skip_rewrite_check = false ) : mixed | void | WP_Error
$post_id integer Post ID of the attachment
$expires integer | null Seconds for the link to live
$size string | null Size of the image to get
$headers array Header overrides for request
$skip_rewrite_check boolean
리턴 mixed | void | WP_Error

get_setting() 공개 메소드

Accessor for a plugin setting with conditions to defaults and upgrades
public get_setting ( string $key, mixed $default = '' ) : integer | mixed | string | WP_Error
$key string
$default mixed
리턴 integer | mixed | string | WP_Error

get_setting_args() 공개 메소드

Gets arguements used to render a setting view.
public get_setting_args ( string $key ) : array
$key string
리턴 array

get_setting_bucket() 공개 메소드

Get the bucket and if a constant save to database and clear region
public get_setting_bucket ( string $key, string $value, string $constant = 'AS3CF_BUCKET' ) : string | false
$key string
$value string
$constant string
리턴 string | false

get_setting_region() 공개 메소드

Get the region setting
public get_setting_region ( array $settings, string $key, mixed $default ) : boolean | string | WP_Error
$settings array
$key string
$default mixed
리턴 boolean | string | WP_Error

get_settings_nonce_key() 공개 메소드

Get the nonce key for the settings form of the plugin
public get_settings_nonce_key ( ) : string
리턴 string

get_settings_tabs() 공개 메소드

Get the tabs available for the plugin settings page
public get_settings_tabs ( ) : array
리턴 array

get_settings_whitelist() 공개 메소드

Whitelist of settings allowed to be saved
public get_settings_whitelist ( ) : array
리턴 array

get_skip_sanitize_settings() 공개 메소드

List of settings that should skip full sanitize.
public get_skip_sanitize_settings ( ) : array
리턴 array

get_url_preview() 공개 메소드

Generate a preview of the URL of files uploaded to S3
public get_url_preview ( boolean $escape = true, string $suffix = 'photo.jpg' ) : string
$escape boolean
$suffix string
리턴 string

get_year_month_directory_name() 공개 메소드

Generate the year and month sub-directory from $time if provided, then POST time if available, otherwise use current time
public get_year_month_directory_name ( string $time = null ) : string
$time string
리턴 string

handle_post_request() 공개 메소드

Handle the saving of the settings page
public handle_post_request ( )

http_prepare_download_log() 공개 메소드

Check for as3cf-download-log and related nonce and if found begin the download of the diagnostic log
public http_prepare_download_log ( ) : void
리턴 void

imagick_enabled() 공개 메소드

Detect is Imagick is enabled
public imagick_enabled ( ) : boolean
리턴 boolean

init() 공개 메소드

Abstract class constructor
public init ( string $plugin_file_path )
$plugin_file_path string

is_attachment_served_by_s3() 공개 메소드

Is attachment served by S3.
public is_attachment_served_by_s3 ( integer $attachment_id, boolean $skip_rewrite_check = false ) : boolean | array
$attachment_id integer
$skip_rewrite_check boolean
리턴 boolean | array

is_current_blog() 공개 메소드

Is the current blog ID that specified in wp-config.php
public is_current_blog ( integer $blog_id ) : boolean
$blog_id integer
리턴 boolean

is_plugin_setup() 공개 메소드

Check the plugin is correctly setup
public is_plugin_setup ( ) : boolean
리턴 boolean

is_pro() 공개 메소드

Check whether the pro addon is installed.
public is_pro ( ) : boolean
리턴 boolean

load_attachment_assets() 공개 메소드

Load the attachment assets only when editing an attachment
public load_attachment_assets ( $hook_suffix )
$hook_suffix

load_media_assets() 공개 메소드

Load media assets.
public load_media_assets ( )

make_acl_admin_notice() 공개 메소드

Make admin notice for when object ACL has changed
public make_acl_admin_notice ( array $s3object )
$s3object array

maybe_convert_size_to_string() 보호된 메소드

Maybe convert size to string
protected maybe_convert_size_to_string ( integer $attachment_id, mixed $size ) : null | string
$attachment_id integer
$size mixed
리턴 null | string

maybe_disable_save_button() 공개 메소드

Disables the save button if all settings have been defined.
public maybe_disable_save_button ( string $defined_settings = [] ) : string
$defined_settings string
리턴 string

maybe_display_deprecated_http_notice() 보호된 메소드

Display a notice if using setting to force HTTP as url scheme, removed in 1.3.

maybe_encode_get_image_tag() 공개 메소드

Maybe encode attachment URLs when retrieving the image tag
public maybe_encode_get_image_tag ( string $html, integer $id, string $alt, string $title, string $align, string $size ) : string
$html string
$id integer
$alt string
$title string
$align string
$size string
리턴 string

maybe_encode_image_get_intermediate_size() 공개 메소드

Maybe encode URLs when retrieving intermediate sizes.
public maybe_encode_image_get_intermediate_size ( array $data, integer $post_id, string | array $size ) : array
$data array
$post_id integer
$size string | array
리턴 array

maybe_encode_wp_get_attachment_image_src() 공개 메소드

Maybe encode URLs for images that represent an attachment
public maybe_encode_wp_get_attachment_image_src ( array | boolean $image, integer $attachment_id, string | array $size, boolean $icon ) : array
$image array | boolean
$attachment_id integer
$size string | array
$icon boolean
리턴 array

maybe_encode_wp_prepare_attachment_for_js() 공개 메소드

Maybe encode URLs when outputting attachments in the media grid
public maybe_encode_wp_prepare_attachment_for_js ( array $response, integer | object $attachment, array $meta ) : array
$response array
$attachment integer | object
$meta array
리턴 array

maybe_remove_query_string() 공개 메소드

Maybe remove query string from URL.
public maybe_remove_query_string ( string $url ) : string
$url string
리턴 string

maybe_sign_intermediate_size() 보호된 메소드

Sign intermediate size.
protected maybe_sign_intermediate_size ( string $url, integer $attachment_id, string | array $size, boolean | array $s3object = false ) : mixed | WP_Error
$url string
$attachment_id integer
$size string | array
$s3object boolean | array
리턴 mixed | WP_Error

maybe_update_cloudfront_path() 공개 메소드

Potentially update path for CloudFront URLs.
public maybe_update_cloudfront_path ( string $path ) : string
$path string
리턴 string

memory_exceeded() 공개 메소드

Ensures the a process never exceeds 90% of the maximum WordPress memory.
public memory_exceeded ( null | string $filter_name = null ) : boolean
$filter_name null | string Name of filter to apply to the return
리턴 boolean

multisite_get_spaced_used() 공개 메소드

Used to give a realistic total of storage space used on a Multisite subsite, when there have been attachments uploaded to S3 but removed from server
public multisite_get_spaced_used ( $space_used ) : float | integer
$space_used bool
리턴 float | integer

normalize_object_prefix() 보호된 메소드

Normalize object prefix.
protected normalize_object_prefix ( string $prefix ) : string
$prefix string
리턴 string

on_off() 공개 메소드

Helper for displaying settings
public on_off ( string $key ) : string
$key string setting key
리턴 string

open_ssl_enabled() 공개 메소드

Detect if OpenSSL is enabled
public open_ssl_enabled ( ) : boolean
리턴 boolean

output_diagnostic_info() 공개 메소드

Diagnostic information for the support tab
public output_diagnostic_info ( boolean $escape = true ) : string
$escape boolean
리턴 string

plugin_deactivated_notice() 공개 메소드

Display a notice after either lite or pro plugin has been auto deactivated

plugin_load() 공개 메소드

public plugin_load ( )

pre_set_setting() 공개 메소드

Perform custom actions before the setting is saved
public pre_set_setting ( string $key, string $value )
$key string
$value string

prepare_bucket_error() 공개 메소드

Prepare the bucket error before returning to JS
public prepare_bucket_error ( WP_Error $object, boolean $single = true ) : array
$object WP_Error
$single boolean Are we dealing with a single bucket?
리턴 array

register_modal_assets() 공개 메소드

Register modal scripts and styles so they can be enqueued later

remove_attachment_files_from_s3() 공개 메소드

Removes an attachment's files from S3.
public remove_attachment_files_from_s3 ( integer $post_id, array $s3object, boolean $remove_backup_sizes = true, boolean $log_error = false, boolean $return_on_error = false, boolean $force_new_s3_client = false )
$post_id integer
$s3object array
$remove_backup_sizes boolean remove previous edited image versions
$log_error boolean
$return_on_error boolean
$force_new_s3_client boolean if we are deleting in bulk, force new S3 client to cope with possible different regions

remove_local_files() 공개 메소드

Remove files from the local site
public remove_local_files ( array $file_paths )
$file_paths array array of files to remove

remove_scheme() 공개 메소드

Remove scheme from URL.
public remove_scheme ( string $url ) : string
$url string
리턴 string

remove_size_from_filename() 공개 메소드

Remove size from filename (image[-100x100].jpeg).
public remove_size_from_filename ( string $url, boolean $remove_extension = false ) : string
$url string
$remove_extension boolean
리턴 string

remove_wp_plugin_dir() 공개 메소드

Helper to remove the plugin directory from the plugin path
public remove_wp_plugin_dir ( string $path ) : string
$path string
리턴 string

render_bucket_permission_errors() 공개 메소드

Render error messages in a view for bucket permission and access issues

render_page() 공개 메소드

Display the main settings page for the plugin
public render_page ( )

restore_current_blog() 공개 메소드

Helper to restore to the current Multisite blog

return_upload_error() 보호된 메소드

Helper to return meta data on upload error
protected return_upload_error ( string $error_msg, array | null $return = null ) : array | WP_Error
$error_msg string
$return array | null
리턴 array | WP_Error

sanitize_custom_domain() 공개 메소드

Sanitize custom domain
public sanitize_custom_domain ( string $domain ) : string
$domain string
리턴 string

save_bucket() 공개 메소드

Save bucket and bucket's region
public save_bucket ( string $bucket_name, boolean $manual = false, null | string $region = null ) : string | boolean
$bucket_name string
$manual boolean if we are entering the bucket via the manual input form
$region null | string
리턴 string | boolean region on success

save_bucket_for_ajax() 공개 메소드

Wrapper method for saving a bucket when creating or selecting
public save_bucket_for_ajax ( string $bucket, boolean | false $manual_select = false, null | string $region = null, array $defaults = [] )
$bucket string
$manual_select boolean | false
$region null | string
$defaults array

schedule_event() 공개 메소드

Wrapper for scheduling cron jobs
public schedule_event ( string $hook, null | string $interval = null, array $args = [] )
$hook string
$interval null | string Defaults to hook if not supplied
$args array

set_attachment_acl_on_s3() 공개 메소드

Apply ACL to an attachment and associated files
public set_attachment_acl_on_s3 ( integer $post_id, array $s3object, string $acl ) : array | boolean | WP_Error
$post_id integer
$s3object array
$acl string
리턴 array | boolean | WP_Error

set_client() 공개 메소드

Setter for S3 client
public set_client ( Aws\S3\S3Client $client )
$client Aws\S3\S3Client

set_setting() 공개 메소드

Setter for a plugin setting with custom hooks
public set_setting ( string $key, mixed $value )
$key string
$value mixed

should_gzip_file() 보호된 메소드

Should gzip file
protected should_gzip_file ( string $file_path, string $type ) : boolean
$file_path string
$type string
리턴 boolean

show_deprecated_domain_setting() 공개 메소드

Show the deprecated Domain option setting?
public show_deprecated_domain_setting ( null | string $domain = null ) : boolean
$domain null | string
리턴 boolean

switch_to_blog() 공개 메소드

Helper to switch to a Multisite blog - If the site is MS - If the blog is not the current blog defined
public switch_to_blog ( integer | boolean $blog_id = false )
$blog_id integer | boolean

translate_region() 공개 메소드

Translate older bucket locations to newer S3 region names http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
public translate_region ( $region ) : string
$region
리턴 string

update_attached_file() 공개 메소드

Allow processes to update the file on S3 via update_attached_file()
public update_attached_file ( string $file, integer $attachment_id ) : string
$file string
$attachment_id integer
리턴 string

update_site_option() 공개 메소드

Update site option.
public update_site_option ( string $option, mixed $value, boolean $autoload = true ) : boolean
$option string
$value mixed
$autoload boolean
리턴 boolean

upgrade_virtual_host() 공개 메소드

Upgrade the 'virtual host' / 'bucket as domain' setting to the new CloudFront / Domain setting
public upgrade_virtual_host ( ) : string
리턴 string

upload_attachment_to_s3() 공개 메소드

Upload attachment to S3
public upload_attachment_to_s3 ( integer $post_id, array | null $data = null, string | null $file_path = null, boolean $force_new_s3_client = false, boolean $remove_local_files = true ) : array | WP_Error
$post_id integer
$data array | null
$file_path string | null
$force_new_s3_client boolean if we are uploading in bulk, force new S3 client to cope with possible different regions
$remove_local_files boolean
리턴 array | WP_Error $s3object|$meta If meta is supplied, return it. Else return S3 meta

use_ssl() 공개 메소드

Determine when to use https in URLS
public use_ssl ( boolean | null $use_ssl = null ) : boolean
$use_ssl boolean | null
리턴 boolean

verify_ajax_request() 공개 메소드

public verify_ajax_request ( )

verify_media_actions() 공개 메소드

Check we can do the media actions
public verify_media_actions ( ) : boolean
리턴 boolean

wp_get_attachment_url() 공개 메소드

Get attachment url
public wp_get_attachment_url ( string $url, integer $post_id ) : boolean | mixed | void | WP_Error
$url string
$post_id integer
리턴 boolean | mixed | void | WP_Error

wp_handle_upload_prefilter() 공개 메소드

Create unique names for file to be uploaded to AWS This only applies when the remove local file option is enabled
public wp_handle_upload_prefilter ( array $file ) : array
$file array An array of data for a single file.
리턴 array $file The altered file array with AWS unique filename.

wp_update_attachment_metadata() 공개 메소드

Handles the upload of the attachment to S3 when an attachment is updated using the 'wp_update_attachment_metadata' filter
public wp_update_attachment_metadata ( array $data, integer $post_id ) : array
$data array meta data for attachment
$post_id integer
리턴 array

프로퍼티 상세

$admin_notices 보호되어 있는 정적으로 프로퍼티

protected static array $admin_notices
리턴 array

$buckets_check 보호되어 있는 정적으로 프로퍼티

Store if each bucket, used by the plugin and addons, is writable
protected static $buckets_check

$default_tab 보호되어 있는 프로퍼티

protected string $default_tab
리턴 string

$filter_local 공개적으로 프로퍼티

public AS3CF_Local_To_S3 $filter_local
리턴 AS3CF_Local_To_S3

$filter_s3 공개적으로 프로퍼티

public AS3CF_S3_To_Local $filter_s3
리턴 AS3CF_S3_To_Local

$hook_suffix 공개적으로 프로퍼티

public string $hook_suffix
리턴 string

$notices 공개적으로 프로퍼티

public AS3CF_Notices $notices
리턴 AS3CF_Notices

$plugin_compat 공개적으로 프로퍼티

public AS3CF_Plugin_Compatibility $plugin_compat
리턴 AS3CF_Plugin_Compatibility

$plugin_menu_title 보호되어 있는 프로퍼티

protected string $plugin_menu_title
리턴 string

$plugin_page 보호되어 있는 정적으로 프로퍼티

protected static $plugin_page

$plugin_prefix 보호되어 있는 프로퍼티

protected string $plugin_prefix
리턴 string

$plugin_title 보호되어 있는 프로퍼티

protected string $plugin_title
리턴 string