mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[task/code-sniffer] Replace spaces with tabs.
PHPBB3-11980
This commit is contained in:
@@ -139,7 +139,7 @@ class metadata_manager
|
||||
|
||||
if (!file_exists($this->metadata_file))
|
||||
{
|
||||
throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file);
|
||||
throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,12 +158,12 @@ class metadata_manager
|
||||
{
|
||||
if (!($file_contents = file_get_contents($this->metadata_file)))
|
||||
{
|
||||
throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file);
|
||||
throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file);
|
||||
}
|
||||
|
||||
if (($metadata = json_decode($file_contents, true)) === null)
|
||||
{
|
||||
throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file);
|
||||
throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file);
|
||||
}
|
||||
|
||||
$this->metadata = $metadata;
|
||||
@@ -191,50 +191,50 @@ class metadata_manager
|
||||
* @return Bool True if valid, throws an exception if invalid
|
||||
*/
|
||||
public function validate($name = 'display')
|
||||
{
|
||||
// Basic fields
|
||||
$fields = array(
|
||||
'name' => '#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#',
|
||||
'type' => '#^phpbb-extension$#',
|
||||
'licence' => '#.+#',
|
||||
'version' => '#.+#',
|
||||
);
|
||||
{
|
||||
// Basic fields
|
||||
$fields = array(
|
||||
'name' => '#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#',
|
||||
'type' => '#^phpbb-extension$#',
|
||||
'licence' => '#.+#',
|
||||
'version' => '#.+#',
|
||||
);
|
||||
|
||||
switch ($name)
|
||||
{
|
||||
case 'all':
|
||||
$this->validate('display');
|
||||
switch ($name)
|
||||
{
|
||||
case 'all':
|
||||
$this->validate('display');
|
||||
|
||||
$this->validate_enable();
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'display':
|
||||
foreach ($fields as $field => $data)
|
||||
case 'display':
|
||||
foreach ($fields as $field => $data)
|
||||
{
|
||||
$this->validate($field);
|
||||
}
|
||||
|
||||
$this->validate_authors();
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isset($fields[$name]))
|
||||
{
|
||||
if (!isset($this->metadata[$name]))
|
||||
{
|
||||
throw new \phpbb\extension\exception("Required meta field '$name' has not been set.");
|
||||
default:
|
||||
if (isset($fields[$name]))
|
||||
{
|
||||
if (!isset($this->metadata[$name]))
|
||||
{
|
||||
throw new \phpbb\extension\exception("Required meta field '$name' has not been set.");
|
||||
}
|
||||
|
||||
if (!preg_match($fields[$name], $this->metadata[$name]))
|
||||
{
|
||||
throw new \phpbb\extension\exception("Meta field '$name' is invalid.");
|
||||
throw new \phpbb\extension\exception("Meta field '$name' is invalid.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the contents of the authors field
|
||||
@@ -245,14 +245,14 @@ class metadata_manager
|
||||
{
|
||||
if (empty($this->metadata['authors']))
|
||||
{
|
||||
throw new \phpbb\extension\exception("Required meta field 'authors' has not been set.");
|
||||
throw new \phpbb\extension\exception("Required meta field 'authors' has not been set.");
|
||||
}
|
||||
|
||||
foreach ($this->metadata['authors'] as $author)
|
||||
{
|
||||
if (!isset($author['name']))
|
||||
{
|
||||
throw new \phpbb\extension\exception("Required meta field 'author name' has not been set.");
|
||||
throw new \phpbb\extension\exception("Required meta field 'author name' has not been set.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user