[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/ -> bp-core-avatars.php (summary)

BuddyPress Avatars.

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

Defines 34 functions

  bp_core_set_avatar_constants()
  bp_core_set_avatar_globals()
  bp_core_fetch_avatar()
  bp_core_delete_existing_avatar()
  bp_avatar_ajax_delete()
  bp_core_avatar_handle_upload()
  bp_avatar_ajax_upload()
  bp_avatar_handle_capture()
  bp_core_avatar_handle_crop()
  bp_avatar_ajax_set()
  bp_core_get_avatar_data_url_filter()
  bp_core_check_avatar_upload()
  bp_core_check_avatar_size()
  bp_core_get_allowed_avatar_types()
  bp_core_get_allowed_avatar_mimes()
  bp_core_check_avatar_type()
  bp_core_get_upload_dir()
  bp_core_avatar_upload_path()
  bp_core_avatar_url()
  bp_get_user_has_avatar()
  bp_core_avatar_dimension()
  bp_core_avatar_thumb_width()
  bp_core_avatar_thumb_height()
  bp_core_avatar_full_width()
  bp_core_avatar_full_height()
  bp_core_avatar_original_max_width()
  bp_core_avatar_original_max_filesize()
  bp_core_avatar_default()
  bp_core_avatar_default_thumb()
  bp_core_avatar_reset_query()
  bp_avatar_is_front_edit()
  bp_avatar_use_webcam()
  bp_avatar_get_templates()
  bp_avatar_template_check()

Functions
Functions that are not part of a class:

bp_core_set_avatar_constants()   X-Ref
Set up the constants we need for avatar support.

since: 1.2.0

bp_core_set_avatar_globals()   X-Ref
Set up global variables related to avatars.

since: 1.5.0

bp_core_fetch_avatar( $args = '' )   X-Ref
Get an avatar for a BuddyPress object.

Supports avatars for users, groups, and blogs by default, but can be
extended to support custom components as well.

This function gives precedence to locally-uploaded avatars. When a local
avatar is not found, Gravatar is queried. To disable Gravatar fallbacks
locally:
add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );

param: array|string $args {
since: 1.1.0
since: 2.4.0 Added 'extra_attr', 'scheme', 'rating' and 'force_default' for $args.
return: string Formatted HTML <img> element, or raw avatar URL based on $html arg.

bp_core_delete_existing_avatar( $args = '' )   X-Ref
Delete an existing avatar.

param: array|string $args {
since: 1.1.0
return: bool True on success, false on failure.

bp_avatar_ajax_delete()   X-Ref
Ajax delete an avatar for a given object and item id.

since: 2.3.0
return: string|null A JSON object containing success data if the avatar was deleted,

bp_core_avatar_handle_upload( $file, $upload_dir_filter )   X-Ref
Handle avatar uploading.

The functions starts off by checking that the file has been uploaded
properly using bp_core_check_avatar_upload(). It then checks that the file
size is within limits, and that it has an accepted file extension (jpg, gif,
png). If everything checks out, crop the image and move it to its real
location.

param: array  $file              The appropriate entry the from $_FILES superglobal.
param: string $upload_dir_filter A filter to be applied to 'upload_dir'.
since: 1.1.0
return: bool True on success, false on failure.

bp_avatar_ajax_upload()   X-Ref
Ajax upload an avatar.

since: 2.3.0
return: string|null A JSON object containing success data if the upload succeeded

bp_avatar_handle_capture( $data = '', $item_id = 0 )   X-Ref
Handle avatar webcam capture.

param: string $data    Base64 encoded image.
param: int    $item_id Item to associate.
since: 2.3.0
return: bool True on success, false on failure.

bp_core_avatar_handle_crop( $args = '' )   X-Ref
Crop an uploaded avatar.

param: array|string $args {
since: 1.1.0
return: bool True on success, false on failure.

bp_avatar_ajax_set()   X-Ref
Ajax set an avatar for a given object and item id.

since: 2.3.0
return: string|null A JSON object containing success data if the crop/capture succeeded

bp_core_get_avatar_data_url_filter( $retval, $id_or_email, $args )   X-Ref
Filter {@link get_avatar_url()} to use the BuddyPress user avatar URL.

param: string $retval      The URL of the avatar.
param: mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
param: array  $args        Arguments passed to get_avatar_data(), after processing.
since: 2.9.0
return: string

bp_core_check_avatar_upload( $file )   X-Ref
Is the current avatar upload error-free?

param: array $file The $_FILES array.
since: 1.0.0
return: bool True if no errors are found. False if there are errors.

bp_core_check_avatar_size( $file )   X-Ref
Is the file size of the current avatar upload permitted?

param: array $file The $_FILES array.
since: 1.0.0
return: bool True if the avatar is under the size limit, otherwise false.

bp_core_get_allowed_avatar_types()   X-Ref
Get allowed avatar types.

since: 2.3.0
return: array

bp_core_get_allowed_avatar_mimes()   X-Ref
Get allowed avatar mime types.

since: 2.3.0
return: array

bp_core_check_avatar_type( $file )   X-Ref
Does the current avatar upload have an allowed file type?

Permitted file types are JPG, GIF and PNG.

param: array $file The $_FILES array.
since: 1.0.0
return: bool True if the file extension is permitted, otherwise false.

bp_core_get_upload_dir( $type = 'upload_path' )   X-Ref
Fetch data from the BP root blog's upload directory.

param: string $type The variable we want to return from the $bp->avatars object.
since: 1.8.0
return: string The avatar upload directory path.

bp_core_avatar_upload_path()   X-Ref
Get the absolute upload path for the WP installation.

since: 1.2.0
return: string Absolute path to WP upload directory.

bp_core_avatar_url()   X-Ref
Get the raw base URL for root site upload location.

since: 1.2.0
return: string Full URL to current upload location.

bp_get_user_has_avatar( $user_id = 0 )   X-Ref
Check if a given user ID has an uploaded avatar.

param: int $user_id ID of the user whose avatar is being checked.
since: 1.0.0
return: bool True if the user has uploaded a local avatar. Otherwise false.

bp_core_avatar_dimension( $type = 'thumb', $h_or_w = 'height' )   X-Ref
Utility function for fetching an avatar dimension setting.

param: string $type   Dimension type you're fetching dimensions for. 'thumb'
param: string $h_or_w Which dimension is being fetched. 'height' or 'width'.
since: 1.5.0
return: int|bool $dim The dimension.

bp_core_avatar_thumb_width()   X-Ref
Get the 'thumb' avatar width setting.

since: 1.5.0
return: int The 'thumb' width.

bp_core_avatar_thumb_height()   X-Ref
Get the 'thumb' avatar height setting.

since: 1.5.0
return: int The 'thumb' height.

bp_core_avatar_full_width()   X-Ref
Get the 'full' avatar width setting.

since: 1.5.0
return: int The 'full' width.

bp_core_avatar_full_height()   X-Ref
Get the 'full' avatar height setting.

since: 1.5.0
return: int The 'full' height.

bp_core_avatar_original_max_width()   X-Ref
Get the max width for original avatar uploads.

since: 1.5.0
return: int The max width for original avatar uploads.

bp_core_avatar_original_max_filesize()   X-Ref
Get the max filesize for original avatar uploads.

since: 1.5.0
return: int The max filesize for original avatar uploads.

bp_core_avatar_default( $type = 'gravatar', $params = array()   X-Ref
Get the URL of the 'full' default avatar.

param: string $type   'local' if the fallback should be the locally-hosted version
param: array  $params Parameters passed to bp_core_fetch_avatar().
since: 1.5.0
since: 2.6.0 Introduced `$params` and `$object_type` parameters.
return: string The URL of the default avatar.

bp_core_avatar_default_thumb( $type = 'gravatar', $params = array()   X-Ref
Get the URL of the 'thumb' default avatar.

Uses Gravatar's mystery-person avatar, unless BP_AVATAR_DEFAULT_THUMB has been
defined.

param: string $type   'local' if the fallback should be the locally-hosted version
param: array  $params Parameters passed to bp_core_fetch_avatar().
since: 1.5.0
since: 2.6.0 Introduced `$object_type` parameter.
return: string The URL of the default avatar thumb.

bp_core_avatar_reset_query( $posts_query = null )   X-Ref
Reset the week parameter of the WordPress main query if needed.

When cropping an avatar, a $_POST['w'] var is sent, setting the 'week'
parameter of the WordPress main query to this posted var. To avoid
notices, we need to make sure this 'week' query var is reset to 0.

param: WP_Query|null $posts_query The main query object.
since: 2.2.0

bp_avatar_is_front_edit()   X-Ref
Checks whether Avatar UI should be loaded.

since: 2.3.0
return: bool True if Avatar UI should load, false otherwise.

bp_avatar_use_webcam()   X-Ref
Checks whether the Webcam Avatar UI part should be loaded.

since: 2.3.0
return: bool True to load the Webcam Avatar UI part. False otherwise.

bp_avatar_get_templates()   X-Ref
Template function to load the Avatar UI javascript templates.

since: 2.3.0

bp_avatar_template_check()   X-Ref
Trick to check if the theme's BuddyPress templates are up to date.

If the "avatar templates" are not including the new template tag, this will
help users to get the avatar UI.

since: 2.3.0



Generated: Mon Jul 22 01:01:43 2019 Cross-referenced by PHPXref 0.7.1