phpBB API Documentation
Class

phpbb\avatar\manager

class manager

Methods

__construct(config $config, array $avatar_drivers)

Construct an avatar manager object

object get_driver(string $avatar_type, bool $load_enabled = true)

Get the driver object specified by the avatar type

array get_all_drivers()

Get a list of all avatar drivers

array get_enabled_drivers()

Get a list of enabled avatar drivers

static array clean_row(array $row, string $prefix = '')

Strip out user_, group_, or other prefixes from array keys

static string clean_driver_name(string $name)

Clean driver names that are returned from template files Underscores are replaced with dots

static string prepare_driver_name(string $name)

Prepare driver names for use in template files Dots are replaced with underscores

bool is_enabled(object $driver)

Check if avatar is enabled

array get_avatar_settings(object $driver)

Get the settings array for enabling/disabling an avatar driver

array localize_errors(user $user, array $error)

Replace "error" strings with their real, localized form

null handle_avatar_delete(driver_interface $db, user $user, array $avatar_data, string $table, string $prefix)

Handle deleting avatars

array prefix_avatar_columns(string $prefix, array $data)

Prefix avatar columns

Details

at line 54
public __construct(config $config, array $avatar_drivers)

Construct an avatar manager object

Parameters

config $config phpBB configuration
array $avatar_drivers Avatar drivers passed via the service container

at line 84
public object get_driver(string $avatar_type, bool $load_enabled = true)

Get the driver object specified by the avatar type

Parameters

string $avatar_type Avatar type; by default an avatar's service container name
bool $load_enabled Load only enabled avatars

Return Value

object Avatar driver object

at line 150
public array get_all_drivers()

Get a list of all avatar drivers

As this function will only be called in the ACP avatar settings page, it doesn't make much sense to cache the list of all avatar drivers like the list of the enabled drivers.

Return Value

array Array containing a list of all avatar drivers

at line 171
public array get_enabled_drivers()

Get a list of enabled avatar drivers

Return Value

array Array containing a list of the enabled avatar drivers

at line 191
static public array clean_row(array $row, string $prefix = '')

Strip out user_, group_, or other prefixes from array keys

Parameters

array $row User data or group data
string $prefix Prefix of data keys (e.g. user), should not include the trailing underscore

Return Value

array User or group data with keys that have been stripped from the preceding "user" or "group" Also the group id is prefixed with g, when the prefix group is removed.

at line 222
static public string clean_driver_name(string $name)

Clean driver names that are returned from template files Underscores are replaced with dots

Parameters

string $name Driver name

Return Value

string Cleaned driver name

at line 235
static public string prepare_driver_name(string $name)

Prepare driver names for use in template files Dots are replaced with underscores

Parameters

string $name Clean driver name

Return Value

string Prepared driver name

at line 247
public bool is_enabled(object $driver)

Check if avatar is enabled

Parameters

object $driver Avatar driver object

Return Value

bool True if avatar is enabled, false if it's disabled

at line 261
public array get_avatar_settings(object $driver)

Get the settings array for enabling/disabling an avatar driver

Parameters

object $driver Avatar driver object

Return Value

array Array of configuration options as consumed by acp_board

at line 281
public array localize_errors(user $user, array $error)

Replace "error" strings with their real, localized form

Parameters

user $user phpBB User object
array $error Array containing error strings Key values can either be a string with a language key or an array that will be passed to vsprintf() with the language key in the first array key.

Return Value

array Array containing the localized error strings

at line 310
public null handle_avatar_delete(driver_interface $db, user $user, array $avatar_data, string $table, string $prefix)

Handle deleting avatars

Parameters

driver_interface $db phpBB dbal
user $user phpBB user object
array $avatar_data Cleaned user data containing the user's avatar data
string $table Database table from which the avatar should be deleted
string $prefix Prefix of user data columns in database

Return Value

null

at line 344
public array prefix_avatar_columns(string $prefix, array $data)

Prefix avatar columns

Parameters

string $prefix Column prefix
array $data Column data

Return Value

array Column data with prefixed column names