diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/includes/avatar/driver/driver.php index 234186215b..6710f1f153 100644 --- a/phpBB/includes/avatar/driver/driver.php +++ b/phpBB/includes/avatar/driver/driver.php @@ -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 * diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/includes/avatar/driver/gravatar.php index 7e21a737a1..6ceac1a149 100644 --- a/phpBB/includes/avatar/driver/gravatar.php +++ b/phpBB/includes/avatar/driver/gravatar.php @@ -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 diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/includes/avatar/driver/interface.php index cc6b7edd17..d2f25a989f 100644 --- a/phpBB/includes/avatar/driver/interface.php +++ b/phpBB/includes/avatar/driver/interface.php @@ -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 diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 669641de70..a7b28acac1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -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 = '