mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/10631] Some tidying up
PHPBB3-10631
This commit is contained in:
parent
ac883e2652
commit
10cba1426d
2 changed files with 12 additions and 60 deletions
|
@ -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');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -84,7 +84,7 @@ class phpbb_extension_metadata_manager
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'name':
|
case 'name':
|
||||||
if($this->validate_name)
|
if ($this->validate_name)
|
||||||
{
|
{
|
||||||
if ($template_output)
|
if ($template_output)
|
||||||
{
|
{
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ class phpbb_extension_metadata_manager
|
||||||
|
|
||||||
$this->metadata_file = $metadata_filepath;
|
$this->metadata_file = $metadata_filepath;
|
||||||
|
|
||||||
if(!file_exists($this->metadata_file))
|
if (!file_exists($this->metadata_file))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue