[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

Core attachment class.

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

Defines 14 functions

  __construct()
  set_upload_dir()
  set_upload_error_strings()
  includes()
  upload()
  sanitize_utf8_filename()
  validate_mime_types()
  validate_upload()
  upload_dir_filter()
  create_dir()
  crop()
  script_data()
  get_image_data()
  edit_image()

Functions
Functions that are not part of a class:

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

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

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.
since: 2.3.0
param: array $param A list of error messages to add to BuddyPress core ones.

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.
since: 2.3.0
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.

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

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

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.
since: 2.3.0
param: array $file The temporary file attributes (before it has been moved).

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

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

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.
since: 2.3.0
param: array $args {

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.
since: 2.4.0
param: string $file Absolute path to the uploaded image.

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,
since: 2.4.0
param: string $attachment_type The attachment type (eg: avatar or cover_image). Required.
param: array  $args {



Generated: Wed Dec 11 01:01:37 2019 Cross-referenced by PHPXref 0.7.1