[ticket/11859] Make avatar drivers return template filename

The service name might not follow the expected naming scheme which would
cause abnormally long filenames and confusion for authors that might add
more avatar drivers.

PHPBB3-11859
This commit is contained in:
Marc Alexander 2013-11-27 15:18:42 +01:00
parent 125e76f9aa
commit 6618f0ea24
5 changed files with 32 additions and 11 deletions

View file

@ -109,17 +109,6 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
return true; return true;
} }
/**
* @inheritdoc
*/
public function get_template_name()
{
$driver = preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this));
$template = "ucp_avatar_options_$driver.html";
return $template;
}
/** /**
* @inheritdoc * @inheritdoc
*/ */

View file

@ -146,6 +146,14 @@ class gravatar extends \phpbb\avatar\driver\driver
); );
} }
/**
* @inheritdoc
*/
public function get_template_name()
{
return 'ucp_avatar_options_gravatar.html';
}
/** /**
* Build gravatar URL for output on page * Build gravatar URL for output on page
* *

View file

@ -134,6 +134,14 @@ class local extends \phpbb\avatar\driver\driver
); );
} }
/**
* @inheritdoc
*/
public function get_template_name()
{
return 'ucp_avatar_options_local.html';
}
/** /**
* Get a list of avatars that are locally available * Get a list of avatars that are locally available
* Results get cached for 24 hours (86400 seconds) * Results get cached for 24 hours (86400 seconds)

View file

@ -186,4 +186,12 @@ class remote extends \phpbb\avatar\driver\driver
'avatar_height' => $height, 'avatar_height' => $height,
); );
} }
/**
* @inheritdoc
*/
public function get_template_name()
{
return 'ucp_avatar_options_remote.html';
}
} }

View file

@ -167,6 +167,14 @@ class upload extends \phpbb\avatar\driver\driver
return true; return true;
} }
/**
* @inheritdoc
*/
public function get_template_name()
{
return 'ucp_avatar_options_upload.html';
}
/** /**
* Check if user is able to upload an avatar * Check if user is able to upload an avatar
* *