class upload extends driver

Handles avatars uploaded to the board

Properties

protected string $name

Avatar driver name

from  driver
protected config $config

Current board configuration

from  driver
protected FastImageSize $imagesize from  driver
protected string $phpbb_root_path

Current $phpbb_root_path

from  driver
protected string $php_ext

Current $php_ext

from  driver
protected path_helper $path_helper

Path Helper

from  driver
protected driver_interface $cache

Cache driver

from  driver
protected array $allowed_extensions

Array of allowed avatar image extensions Array is used for setting the allowed extensions in the fileupload class and as a base for a regex of allowed extensions, which will be formed by imploding the array with a "|".

from  driver
protected storage $storage
protected dispatcher_interface $dispatcher
protected factory $files_factory
protected IniGetWrapper $php_ini

Methods

__construct(config $config, helper $controller_helper, string $phpbb_root_path, string $php_ext, storage $storage, path_helper $path_helper, dispatcher_interface $dispatcher, factory $files_factory, IniGetWrapper $php_ini)

Construct a driver object

string
get_custom_html(user $user, array $row, string $alt = '')

Returns custom html if it is needed for displaying this avatar

from  driver
array
prepare_form_acp(user $user)

Prepare form for changing the acp settings of this avatar

bool
delete(array $row)

Delete avatar

string
get_name()

Returns the name of the driver.

from  driver
string
get_config_name()

Returns the config name of the driver. To be used in accessing the CONFIG variables.

from  driver
string
get_acp_template_name()

Get the avatar driver's template name (ACP)

from  driver
set_name(string $name)

Sets the name of the driver.

from  driver
array
get_data(array $row)

Get the avatar url and dimensions

bool
prepare_form(request $request, template $template, user $user, array $row, array $error)

Prepare form for changing the settings of this avatar

array
process_form(request $request, template $template, user $user, array $row, array $error)

Process form data

string
get_template_name()

Get the avatar driver's template name

bool
can_upload()

Check if user is able to upload an avatar to a temporary folder

Details

at line 68
__construct(config $config, helper $controller_helper, string $phpbb_root_path, string $php_ext, storage $storage, path_helper $path_helper, dispatcher_interface $dispatcher, factory $files_factory, IniGetWrapper $php_ini)

Construct a driver object

Parameters

config $config

phpBB configuration

helper $controller_helper
string $phpbb_root_path

Path to the phpBB root

string $php_ext

PHP file extension

storage $storage

phpBB avatar storage

path_helper $path_helper

phpBB path helper

dispatcher_interface $dispatcher

phpBB Event dispatcher object

factory $files_factory

File classes factory

IniGetWrapper $php_ini

ini_get() wrapper

in driver at line 98
string get_custom_html(user $user, array $row, string $alt = '')

Returns custom html if it is needed for displaying this avatar

Parameters

user $user

phpBB user object

array $row

User data or group data that has been cleaned with \phpbb\avatar\manager::clean_row

string $alt

Alternate text for avatar image

Return Value

string

HTML

at line 217
array prepare_form_acp(user $user)

Prepare form for changing the acp settings of this avatar

Parameters

user $user

phpBB user object

Return Value

array

Array of configuration options as consumed by acp_board. The setting for enabling/disabling the avatar will be handled by the avatar manager.

at line 227
bool delete(array $row)

Delete avatar

Parameters

array $row

User data or group data that has been cleaned with \phpbb\avatar\manager::clean_row

Return Value

bool

True if avatar has been deleted or there is no need to delete, i.e. when the avatar is not hosted locally.

in driver at line 122
string get_name()

Returns the name of the driver.

Return Value

string

Name of driver.

in driver at line 130
string get_config_name()

Returns the config name of the driver. To be used in accessing the CONFIG variables.

Return Value

string

Config name of driver.

in driver at line 138
string get_acp_template_name()

Get the avatar driver's template name (ACP)

Return Value

string

Avatar driver's template name

in driver at line 148
set_name(string $name)

Sets the name of the driver.

Parameters

string $name

Driver name

at line 84
array get_data(array $row)

Get the avatar url and dimensions

Parameters

array $row

User data or group data that has been cleaned with \phpbb\avatar\manager::clean_row

Return Value

array

Avatar data, must have keys src, width and height, e.g. ['src' => '', 'width' => 0, 'height' => 0]

at line 96
bool prepare_form(request $request, template $template, user $user, array $row, array $error)

Prepare form for changing the settings of this avatar

Parameters

request $request

Request object

template $template

Template object

user $user

User object

array $row

User data or group data that has been cleaned with \phpbb\avatar\manager::clean_row

array $error

Reference to an error array that is filled by this function. 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

bool

True if form has been successfully prepared

at line 114
array process_form(request $request, template $template, user $user, array $row, array $error)

Process form data

Parameters

request $request

Request object

template $template

Template object

user $user

User object

array $row

User data or group data that has been cleaned with \phpbb\avatar\manager::clean_row

array $error

Reference to an error array that is filled by this function. 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 avatar data as follows: ['avatar'], ['avatar_width'], ['avatar_height']

at line 271
string get_template_name()

Get the avatar driver's template name

Return Value

string

Avatar driver's template name

at line 281
protected bool can_upload()

Check if user is able to upload an avatar to a temporary folder

Return Value

bool

True if user can upload, false if not