aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/avatar/driver/driver_interface.php
blob: 7d6c2cff8a4bb62c647796511247c34dbed02e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

namespace phpbb\avatar\driver;

/**
* Interface for avatar drivers
*/
interface driver_interface
{
	/**
	* Returns the name of the driver.
	*
	* @return string	Name of driver.
	*/
	public function get_name();

	/**
	* Returns the config name of the driver. To be used in accessing the CONFIG variables.
	*
	* @return string	Config name of driver.
	*/
	public function get_config_name();

	/**
	* Get the avatar url and dimensions
	*
	* @param array	$row User data or group data that has been cleaned with
	*        \phpbb\avatar\manager::clean_row
	* @return array Avatar data, must have keys src, width and height, e.g.
	*        ['src' => '', 'width' => 0, 'height' => 0]
	*/
	public function get_data($row);

	/**
	* Returns custom html if it is needed for displaying this avatar
	*
	* @param \phpbb\user $user phpBB user object
	* @param array	$row User data or group data that has been cleaned with
	*        \phpbb\avatar\manager::clean_row
	* @param string $alt Alternate text for avatar image
	*
	* @return string HTML
	*/
	public function get_custom_html($user, $row, $alt = '');

	/**
	* Prepare form for changing the settings of this avatar
	*
	* @param \phpbb\request\request $request Request object
	* @param \phpbb\template\template	$template Template object
	* @param \phpbb\user $user User object
	* @param array	$row User data or group data that has been cleaned with
	*        \phpbb\avatar\manager::clean_row
	* @param 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 bool True if form has been successfully prepared
	*/
	public function prepare_form($request, $template, $user, $row, &$error);

	/**
	* Prepare form for changing the acp settings of this avatar
	*
	* @param \phpbb\user $user phpBB user object
	*
	* @return array Array of configuration options as consumed by acp_board.
	*        The setting for enabling/disabling the avatar will be handled by
	*        the avatar manager.
	*/
	public function prepare_form_acp($user);

	/**
	* Process form data
	*
	* @param \phpbb\request\request $request Request object
	* @param \phpbb\template\template	$template Template object
	* @param \phpbb\user $user User object
	* @param array	$row User data or group data that has been cleaned with
	*        \phpbb\avatar\manager::clean_row
	* @param 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 array Array containing the avatar data as follows:
	*        ['avatar'], ['avatar_width'], ['avatar_height']
	*/
	public function process_form($request, $template, $user, $row, &$error);

	/**
	* Delete avatar
	*
	* @param array $row User data or group data that has been cleaned with
	*        \phpbb\avatar\manager::clean_row
	*
	* @return bool True if avatar has been deleted or there is no need to delete,
	*        i.e. when the avatar is not hosted locally.
	*/
	public function delete($row);

	/**
	* Get the avatar driver's template name
	*
	* @return string Avatar driver's template name
	*/
	public function get_template_name();

	/**
	* Get the avatar driver's template name (ACP)
	*
	* @return string Avatar driver's template name
	*/
	public function get_acp_template_name();
}