1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[ticket/10631] Remove code duplication

PHPBB3-10631
This commit is contained in:
Nathan Guse 2012-07-23 15:22:48 -05:00 committed by Unknown Bliss
parent 8bbab088dd
commit 4314284de1

View File

@ -232,22 +232,29 @@ class phpbb_extension_metadata_manager
*/
public function validate_metadata_array()
{
$validate = array(
'name',
'type',
'licence',
'description',
'version',
'extra_display-name',
);
foreach ($validate as $type)
foreach ($this->validation as $name => $regex)
{
$type = 'validate_' . $type;
if (!$this->$type())
if (is_array($regex))
{
return false;
foreach ($regex as $extra_name => $extra_regex)
{
$type = 'validate_' . $name . '_' . $extra_name;
if (!$this->$type())
{
return false;
}
}
}
else
{
$type = 'validate_' . $name;
if (!$this->$type())
{
return false;
}
}
}