[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

Core attachment class.

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

Defines 15 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()
  add_revision()
  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()

since: 2.3.0
return: array $upload_errors The list of upload errors.
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.

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

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

since: 2.9.0
return: string
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.

since: 2.3.0
return: array The file.
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.

since: 2.3.0
since: 2.4.0 Add the $upload_dir parameter to the method
return: array The upload directory data.
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.

since: 2.3.0
return: string|WP_Error New filepath on success, WP_Error on failure.
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.

since: 2.3.0
return: array The javascript localization data.

add_revision( $attachment_type, $args = array()   X-Ref
Adds a new revision of a file.

since: 10.0.0
return: object|WP_Error An object informing about the URL an Path to a revision file, a WP_Error object on failure.
param: string $attachment_type The attachement type (eg: avatar).
param: array $args {

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

since: 2.4.0
return: bool|array   An associate array containing the width, height and metadatas.
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

since: 2.4.0
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 {



Generated: Fri Apr 26 01:01:11 2024 Cross-referenced by PHPXref 0.7.1