[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

BuddyPress Avatars.

File Size: 2028 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' );

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

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

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

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

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

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.

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

bp_avatar_ajax_upload()   X-Ref
Ajax upload an avatar.

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

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

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

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

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

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

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

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.

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

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

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

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

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

bp_core_get_allowed_avatar_types()   X-Ref
Get allowed avatar types.

return: array
since: 2.3.0

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

return: array
since: 2.3.0

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return: string The URL of the default avatar.
since: 1.5.0
since: 2.6.0 Introduced `$params` and `$object_type` parameters.
param: string $type   'local' if the fallback should be the locally-hosted version
param: array  $params Parameters passed to bp_core_fetch_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.

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

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.

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

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

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

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

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

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: Sat Dec 14 01:01:40 2019 Cross-referenced by PHPXref 0.7.1