[ticket/10631] Some tidying up

PHPBB3-10631
This commit is contained in:
Michael Cullum 2012-05-19 23:32:34 +01:00 committed by Unknown Bliss
parent ac883e2652
commit 10cba1426d
2 changed files with 12 additions and 60 deletions

View file

@ -464,3 +464,4 @@ class phpbb_extension_manager
{ {
return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
} }
}

View file

@ -39,7 +39,7 @@ class phpbb_extension_metadata_manager
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $phpEx php file extension * @param string $phpEx php file extension
*/ */
public function __construct($ext_name, dbal $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', template $template) public function __construct($ext_name, dbal $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->db = $db; $this->db = $db;
@ -106,7 +106,7 @@ class phpbb_extension_metadata_manager
/** /**
* Sets the filepath of the metadata file * Sets the filepath of the metadata file
* *
* @return null * @return boolean Set to true if it exists
*/ */
private function set_meta_data_file() private function set_meta_data_file()
{ {
@ -153,14 +153,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_name() private function validate_name()
{ {
if(preg_match('^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$', $this->metadata['name'])) return preg_match('^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$', $this->metadata['name']);
{
return true;
}
else
{
return false;
}
} }
/** /**
@ -170,14 +163,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_type() private function validate_type()
{ {
if ($this->metadata['type'] != 'phpbb3-extension') return $this->metadata['type'] != 'phpbb3-extension';
{
return false;
}
else
{
return true;
}
} }
/** /**
@ -187,14 +173,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_description() private function validate_description()
{ {
if(preg_match('^{10,}$', $this->metadata['description'])) return preg_match('^{10,}$', $this->metadata['description']);
{
return true;
}
else
{
return false;
}
} }
/** /**
@ -204,14 +183,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_version() private function validate_version()
{ {
if(preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$', $this->metadata['version'])) return preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$', $this->metadata['version']);
{
return true;
}
else
{
return false;
}
} }
/** /**
@ -221,14 +193,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_license() private function validate_license()
{ {
if ($this->metadata['license'] != 'GPLv2') return $this->metadata['license'] != 'GPLv2';
{
return false;
}
else
{
return true;
}
} }
/** /**
@ -238,14 +203,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_require_phpbb() private function validate_require_phpbb()
{ {
if(preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$', $this->metadata['require']['phpbb']) && version_compare($this->metadata['require']['phpbb']), '3.1.0', '>') return (preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$', $this->metadata['require']['phpbb']) && version_compare($this->metadata['require']['phpbb']), '3.1.0', '>');
{
return true;
}
else
{
return false;
}
} }
/** /**
@ -255,14 +213,7 @@ class phpbb_extension_metadata_manager
*/ */
private function validate_extra_display_name() private function validate_extra_display_name()
{ {
if(preg_match('^[a-zA-Z0-9_]{2,0}$', $this->metadata['name'])) return preg_match('^[a-zA-Z0-9_]{2,0}$', $this->metadata['name']);
{
return true;
}
else
{
return false;
}
} }
/** /**