Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | namespace phpbb\avatar\driver; |
| 15 | |
| 16 | /** |
| 17 | * Interface for avatar drivers |
| 18 | */ |
| 19 | interface driver_interface |
| 20 | { |
| 21 | /** |
| 22 | * Returns the name of the driver. |
| 23 | * |
| 24 | * @return string Name of driver. |
| 25 | */ |
| 26 | public function get_name(); |
| 27 | |
| 28 | /** |
| 29 | * Returns the config name of the driver. To be used in accessing the CONFIG variables. |
| 30 | * |
| 31 | * @return string Config name of driver. |
| 32 | */ |
| 33 | public function get_config_name(); |
| 34 | |
| 35 | /** |
| 36 | * Get the avatar url and dimensions |
| 37 | * |
| 38 | * @param array $row User data or group data that has been cleaned with |
| 39 | * \phpbb\avatar\manager::clean_row |
| 40 | * @return array Avatar data, must have keys src, width and height, e.g. |
| 41 | * ['src' => '', 'width' => 0, 'height' => 0] |
| 42 | */ |
| 43 | public function get_data($row); |
| 44 | |
| 45 | /** |
| 46 | * Returns custom html if it is needed for displaying this avatar |
| 47 | * |
| 48 | * @param \phpbb\user $user phpBB user object |
| 49 | * @param array $row User data or group data that has been cleaned with |
| 50 | * \phpbb\avatar\manager::clean_row |
| 51 | * @param string $alt Alternate text for avatar image |
| 52 | * |
| 53 | * @return string HTML |
| 54 | */ |
| 55 | public function get_custom_html($user, $row, $alt = ''); |
| 56 | |
| 57 | /** |
| 58 | * Prepare form for changing the settings of this avatar |
| 59 | * |
| 60 | * @param \phpbb\request\request $request Request object |
| 61 | * @param \phpbb\template\template $template Template object |
| 62 | * @param \phpbb\user $user User object |
| 63 | * @param array $row User data or group data that has been cleaned with |
| 64 | * \phpbb\avatar\manager::clean_row |
| 65 | * @param array &$error Reference to an error array that is filled by this |
| 66 | * function. Key values can either be a string with a language key or |
| 67 | * an array that will be passed to vsprintf() with the language key in |
| 68 | * the first array key. |
| 69 | * |
| 70 | * @return bool True if form has been successfully prepared |
| 71 | */ |
| 72 | public function prepare_form($request, $template, $user, $row, &$error); |
| 73 | |
| 74 | /** |
| 75 | * Prepare form for changing the acp settings of this avatar |
| 76 | * |
| 77 | * @param \phpbb\user $user phpBB user object |
| 78 | * |
| 79 | * @return array Array of configuration options as consumed by acp_board. |
| 80 | * The setting for enabling/disabling the avatar will be handled by |
| 81 | * the avatar manager. |
| 82 | */ |
| 83 | public function prepare_form_acp($user); |
| 84 | |
| 85 | /** |
| 86 | * Process form data |
| 87 | * |
| 88 | * @param \phpbb\request\request $request Request object |
| 89 | * @param \phpbb\template\template $template Template object |
| 90 | * @param \phpbb\user $user User object |
| 91 | * @param array $row User data or group data that has been cleaned with |
| 92 | * \phpbb\avatar\manager::clean_row |
| 93 | * @param array &$error Reference to an error array that is filled by this |
| 94 | * function. Key values can either be a string with a language key or |
| 95 | * an array that will be passed to vsprintf() with the language key in |
| 96 | * the first array key. |
| 97 | * |
| 98 | * @return array|false Array containing the avatar data as follows or false if processing failed: |
| 99 | * ['avatar'], ['avatar_width'], ['avatar_height'] |
| 100 | */ |
| 101 | public function process_form($request, $template, $user, $row, &$error); |
| 102 | |
| 103 | /** |
| 104 | * Delete avatar |
| 105 | * |
| 106 | * @param array $row User data or group data that has been cleaned with |
| 107 | * \phpbb\avatar\manager::clean_row |
| 108 | * |
| 109 | * @return bool True if avatar has been deleted or there is no need to delete, |
| 110 | * i.e. when the avatar is not hosted locally. |
| 111 | */ |
| 112 | public function delete($row); |
| 113 | |
| 114 | /** |
| 115 | * Get the avatar driver's template name |
| 116 | * |
| 117 | * @return string Avatar driver's template name |
| 118 | */ |
| 119 | public function get_template_name(); |
| 120 | |
| 121 | /** |
| 122 | * Get the avatar driver's template name (ACP) |
| 123 | * |
| 124 | * @return string Avatar driver's template name |
| 125 | */ |
| 126 | public function get_acp_template_name(); |
| 127 | } |