[ Index ]

PHP Cross Reference of BuddyPress




/src/bp-core/classes/ -> class-bp-attachment.php (summary)

Core attachment class.

File Size: 676 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 14 functions


Functions that are not part of a class:

__construct( $args = '' )   X-Ref
Construct Upload parameters.

param: array|string $args {
since: 2.3.0
since: 2.4.0 Add the $upload_dir_filter_args argument to the $arguments array

set_upload_dir()   X-Ref
Set upload path and url for the component.

since: 2.3.0

set_upload_error_strings( $param = array()   X-Ref
Set Upload error messages.

Used into the $overrides argument of BP_Attachment->upload()

return: array $upload_errors The list of upload errors.
param: array $param A list of error messages to add to BuddyPress core ones.
since: 2.3.0

includes()   X-Ref
Include the WordPress core needed files.

since: 2.3.0

upload( $file, $upload_dir_filter = '', $time = null )   X-Ref
Upload the attachment.

return: array On success, returns an associative array of file attributes.
param: array       $file              The appropriate entry the from $_FILES superglobal.
param: string      $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional).
param: string|null $time              Optional. Time formatted in 'yyyy/mm'. Default null.
since: 2.3.0

sanitize_utf8_filename( $retval )   X-Ref
Helper to convert utf-8 characters in filenames to their ASCII equivalent.

return: string
param: string $retval Filename.
since: 2.9.0

validate_mime_types()   X-Ref
Validate the allowed mime types using WordPress allowed mime types.

In case of a multisite, the mime types are already restricted by
the 'upload_filetypes' setting. BuddyPress will respect this setting.

since: 2.3.0

validate_upload( $file = array()   X-Ref
Specific upload rules.

Override this function from your child class to build your specific rules
By default, if an original_max_filesize is provided, a check will be done
on the file size.

return: array The file.
param: array $file The temporary file attributes (before it has been moved).
since: 2.3.0

upload_dir_filter( $upload_dir = array()   X-Ref
Default filter to save the attachments.

return: array The upload directory data.
param: array $upload_dir The original Uploads dir.
since: 2.3.0
since: 2.4.0 Add the $upload_dir parameter to the method

create_dir()   X-Ref
Create the custom base directory for the component uploads.

Override this function in your child class to run specific actions.
(eg: add an .htaccess file)

since: 2.3.0

crop( $args = array()   X-Ref
Crop an image file.

return: string|WP_Error New filepath on success, WP_Error on failure.
param: array $args {
since: 2.3.0

script_data()   X-Ref
Build script datas for the Uploader UI.

Override this method from your child class to build the script datas.

return: array The javascript localization data.
since: 2.3.0

get_image_data( $file )   X-Ref
Get full data for an image

return: bool|array   An associate array containing the width, height and metadatas.
param: string $file Absolute path to the uploaded image.
since: 2.4.0

edit_image( $attachment_type, $args = array()   X-Ref
Edit an image file to resize it or rotate it

return: string|WP_Image_Editor|WP_Error The edited image path or the WP_Image_Editor object in case of success,
param: string $attachment_type The attachment type (eg: avatar or cover_image). Required.
param: array  $args {
since: 2.4.0

Generated: Sun Apr 18 01:01:43 2021 Cross-referenced by PHPXref 0.7.1