1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/16250] Reworked status as constants

PHPBB3-16250
This commit is contained in:
JoshyPHP
2019-12-16 01:34:26 +01:00
parent 2926ceba6a
commit 2733ce0712
3 changed files with 30 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ class acp_utils implements acp_utils_interface
public function analyse_bbcode(string $definition, string $template): array
{
$configurator = $this->factory->get_configurator();
$return = ['status' => 'safe'];
$return = ['status' => self::BBCODE_STATUS_SAFE];
// Capture and normalize the BBCode name manually because there's no easy way to retrieve
// it in TextFormatter <= 2.x
@@ -52,13 +52,13 @@ class acp_utils implements acp_utils_interface
}
catch (UnsafeTemplateException $e)
{
$return['status'] = 'unsafe';
$return['status'] = self::BBCODE_STATUS_UNSAFE;
$return['error_text'] = $e->getMessage();
$return['error_html'] = $e->highlightNode('<span class="highlight">');
}
catch (\Exception $e)
{
$return['status'] = (preg_match('(xml|xpath|xsl)i', $e->getMessage())) ? 'invalid_template' : 'invalid_definition';
$return['status'] = (preg_match('(xml|xpath|xsl)i', $e->getMessage())) ? self::BBCODE_STATUS_INVALID_TEMPLATE : self::BBCODE_STATUS_INVALID_DEFINITION;
$return['error_text'] = $e->getMessage();
}