Method |
Description |
|
__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 |
|