diff options
Diffstat (limited to 'phpBB/phpbb/extension')
-rw-r--r-- | phpBB/phpbb/extension/base.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/extension/exception.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/extension/extension_interface.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/extension/finder.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/extension/manager.php | 14 | ||||
-rw-r--r-- | phpBB/phpbb/extension/metadata_manager.php | 72 | ||||
-rw-r--r-- | phpBB/phpbb/extension/provider.php | 8 |
7 files changed, 38 insertions, 88 deletions
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index a529cc7961..1f871750e0 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -9,14 +9,6 @@ namespace phpbb\extension; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/phpBB/phpbb/extension/exception.php b/phpBB/phpbb/extension/exception.php index e2ba647878..b1f4997fdd 100644 --- a/phpBB/phpbb/extension/exception.php +++ b/phpBB/phpbb/extension/exception.php @@ -10,14 +10,6 @@ namespace phpbb\extension; /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * Exception class for metadata */ class exception extends \UnexpectedValueException diff --git a/phpBB/phpbb/extension/extension_interface.php b/phpBB/phpbb/extension/extension_interface.php index 1e5f546dc5..bddff51b5a 100644 --- a/phpBB/phpbb/extension/extension_interface.php +++ b/phpBB/phpbb/extension/extension_interface.php @@ -10,14 +10,6 @@ namespace phpbb\extension; /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * The interface extension meta classes have to implement to run custom code * on enable/disable/purge. * diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index e787919588..c9c16ae6d5 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -10,14 +10,6 @@ namespace phpbb\extension; /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * The extension finder provides a simple way to locate files in active extensions * * @package extension diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index ce6d7e05c8..7f009867c9 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -9,14 +9,6 @@ namespace phpbb\extension; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -234,7 +226,9 @@ class manager */ public function enable($name) { + // @codingStandardsIgnoreStart while ($this->enable_step($name)); + // @codingStandardsIgnoreEnd } /** @@ -311,7 +305,9 @@ class manager */ public function disable($name) { + // @codingStandardsIgnoreStart while ($this->disable_step($name)); + // @codingStandardsIgnoreEnd } /** @@ -388,7 +384,9 @@ class manager */ public function purge($name) { + // @codingStandardsIgnoreStart while ($this->purge_step($name)); + // @codingStandardsIgnoreEnd } /** diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 19c6288e96..d0323120d8 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -10,14 +10,6 @@ namespace phpbb\extension; /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * The extension metadata manager validates and gets meta-data for extensions * * @package extension @@ -147,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); } } @@ -166,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) + 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; @@ -199,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' => '#.+#', - ); - - switch ($name) - { - case 'all': - $this->validate('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' => '#.+#', + ); + + 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; - - default: - if (isset($fields[$name])) - { - if (!isset($this->metadata[$name])) - { - throw new \phpbb\extension\exception("Required meta field '$name' has not been set."); + break; + + 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 @@ -253,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."); } } diff --git a/phpBB/phpbb/extension/provider.php b/phpBB/phpbb/extension/provider.php index c2a264d311..bfdc2b66b9 100644 --- a/phpBB/phpbb/extension/provider.php +++ b/phpBB/phpbb/extension/provider.php @@ -10,14 +10,6 @@ namespace phpbb\extension; /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * Provides a set of items found in extensions. * * This abstract class is essentially a wrapper around item-specific |