mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/avatars] Properly implement custom HTML in the interface
Previously the driver class added a variable that defined wether an avatar driver would return custom HTML. The existence of this variable was implied in the interface. It's also not needed which is why it has been removed. PHPBB3-10018
This commit is contained in:
parent
cb1d98ab7f
commit
81a1a21185
4 changed files with 7 additions and 17 deletions
|
@ -57,13 +57,6 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
|
|||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* This flag should be set to true if the avatar requires a nonstandard image
|
||||
* tag, and will generate the html itself.
|
||||
* @var boolean
|
||||
*/
|
||||
public $custom_html = false;
|
||||
|
||||
/**
|
||||
* Construct a driver object
|
||||
*
|
||||
|
|
|
@ -21,12 +21,10 @@ if (!defined('IN_PHPBB'))
|
|||
*/
|
||||
class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
|
||||
{
|
||||
const GRAVATAR_URL = 'https://secure.gravatar.com/avatar/';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* The URL for the gravatar service
|
||||
*/
|
||||
public $custom_html = true;
|
||||
const GRAVATAR_URL = 'https://secure.gravatar.com/avatar/';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
|
|
@ -40,8 +40,7 @@ interface phpbb_avatar_driver_interface
|
|||
public function get_data($row, $ignore_config = false);
|
||||
|
||||
/**
|
||||
* Returns custom html for displaying this avatar.
|
||||
* Only called if $custom_html is true.
|
||||
* Returns custom html if it is needed for displaying this avatar
|
||||
*
|
||||
* @param bool $ignore_config Whether this function should respect the users prefs
|
||||
* and board configuration configuration option, or should just render
|
||||
|
|
|
@ -1368,12 +1368,14 @@ function get_avatar($row, $alt, $ignore_config = false)
|
|||
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']);
|
||||
$html = '';
|
||||
|
||||
if ($avatar)
|
||||
{
|
||||
if ($avatar->custom_html)
|
||||
$html = $avatar->get_custom_html($row, $ignore_config, $alt);
|
||||
if (!empty($html))
|
||||
{
|
||||
return $avatar->get_custom_html($row, $ignore_config, $alt);
|
||||
return $html;
|
||||
}
|
||||
|
||||
$avatar_data = $avatar->get_data($row, $ignore_config);
|
||||
|
@ -1383,8 +1385,6 @@ function get_avatar($row, $alt, $ignore_config = false)
|
|||
$avatar_data['src'] = '';
|
||||
}
|
||||
|
||||
$html = '';
|
||||
|
||||
if (!empty($avatar_data['src']))
|
||||
{
|
||||
$html = '<img src="' . $avatar_data['src'] . '" ' .
|
||||
|
|
Loading…
Add table
Reference in a new issue