1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-19 06:51:33 +02:00

[ticket/11700] Move all recent code to namespaces

PHPBB3-11700
This commit is contained in:
Nils Adermann
2013-09-10 14:01:09 +02:00
parent 196e1813cd
commit b95fdacdd3
420 changed files with 2316 additions and 1840 deletions

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\extension;
/**
* @ignore
*/
@@ -20,23 +22,23 @@ if (!defined('IN_PHPBB'))
*
* @package extension
*/
class phpbb_extension_metadata_manager
class metadata_manager
{
/**
* phpBB Config instance
* @var phpbb_config
* @var \phpbb\config\config
*/
protected $config;
/**
* phpBB Extension Manager
* @var phpbb_extension_manager
* @var \phpbb\extension\manager
*/
protected $extension_manager;
/**
* phpBB Template instance
* @var phpbb_template
* @var \phpbb\template\template
*/
protected $template;
@@ -68,12 +70,12 @@ class phpbb_extension_metadata_manager
* Creates the metadata manager
*
* @param string $ext_name Name (including vendor) of the extension
* @param phpbb_config $config phpBB Config instance
* @param phpbb_extension_manager $extension_manager An instance of the phpBBb extension manager
* @param phpbb_template $template phpBB Template instance
* @param \phpbb\config\config $config phpBB Config instance
* @param \phpbb\extension\manager $extension_manager An instance of the phpBBb extension manager
* @param \phpbb\template\template $template phpBB Template instance
* @param string $phpbb_root_path Path to the phpbb includes directory.
*/
public function __construct($ext_name, phpbb_config $config, phpbb_extension_manager $extension_manager, phpbb_template $template, $phpbb_root_path)
public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, $phpbb_root_path)
{
$this->config = $config;
$this->extension_manager = $extension_manager;
@@ -145,7 +147,7 @@ class phpbb_extension_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,18 +160,18 @@ class phpbb_extension_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);
}
else
{
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;
@@ -228,12 +230,12 @@ class phpbb_extension_metadata_manager
{
if (!isset($this->metadata[$name]))
{
throw new phpbb_extension_exception("Required meta field '$name' has not been set.");
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;
@@ -251,14 +253,14 @@ class phpbb_extension_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.");
}
}