aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textformatter
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-04-30 23:01:28 +0200
committerJoshyPHP <s9e.dev@gmail.com>2015-05-18 02:58:33 +0200
commitdeadc0665298f18a937fc959da449e9098873c0b (patch)
tree633597f2c11943693ced5425b341a74967a9f9c0 /phpBB/phpbb/textformatter
parentc967ba7b9ba42d9cf72cd1bb0927ae5214894eda (diff)
downloadforums-deadc0665298f18a937fc959da449e9098873c0b.tar
forums-deadc0665298f18a937fc959da449e9098873c0b.tar.gz
forums-deadc0665298f18a937fc959da449e9098873c0b.tar.bz2
forums-deadc0665298f18a937fc959da449e9098873c0b.tar.xz
forums-deadc0665298f18a937fc959da449e9098873c0b.zip
[ticket/13801] Removed user dependency from text_formatter.s9e.parser
PHPBB3-13801
Diffstat (limited to 'phpBB/phpbb/textformatter')
-rw-r--r--phpBB/phpbb/textformatter/s9e/parser.php27
1 files changed, 8 insertions, 19 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php
index e46a0578d2..178669d84f 100644
--- a/phpBB/phpbb/textformatter/s9e/parser.php
+++ b/phpBB/phpbb/textformatter/s9e/parser.php
@@ -32,20 +32,14 @@ class parser implements \phpbb\textformatter\parser_interface
protected $parser;
/**
- * @var \phpbb\user User object, used for translating errors
- */
- protected $user;
-
- /**
* Constructor
*
* @param \phpbb\cache\driver_interface $cache
* @param string $key Cache key
- * @param \phpbb\user $user
* @param factory $factory
* @param \phpbb\event\dispatcher_interface $dispatcher
*/
- public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, \phpbb\user $user, factory $factory, \phpbb\event\dispatcher_interface $dispatcher)
+ public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, factory $factory, \phpbb\event\dispatcher_interface $dispatcher)
{
$parser = $cache->get($key);
if (!$parser)
@@ -56,24 +50,20 @@ class parser implements \phpbb\textformatter\parser_interface
$this->dispatcher = $dispatcher;
$this->parser = $parser;
- $this->user = $user;
$parser = $this;
/**
* Configure the parser service
*
* Can be used to:
- * - toggle features according to the user's preferences,
- * - toggle BBCodes according to the user's permissions,
* - register variables or custom parsers in the s9e\TextFormatter
* - configure the s9e\TextFormatter parser
*
* @event core.text_formatter_s9e_parser_setup
* @var \phpbb\textformatter\s9e\parser parser This parser service
- * @var \phpbb\user user Current user
* @since 3.2.0-a1
*/
- $vars = array('parser', 'user');
+ $vars = array('parser');
extract($dispatcher->trigger_event('core.text_formatter_s9e_parser_setup', compact($vars)));
}
@@ -202,7 +192,6 @@ class parser implements \phpbb\textformatter\parser_interface
public function get_errors()
{
$errors = array();
-
foreach ($this->parser->getLogger()->get() as $entry)
{
list($type, $msg, $context) = $entry;
@@ -211,29 +200,29 @@ class parser implements \phpbb\textformatter\parser_interface
{
if ($context['tagName'] === 'E')
{
- $errors[] = $this->user->lang('TOO_MANY_SMILIES', $context['tagLimit']);
+ $errors[] = array('TOO_MANY_SMILIES', $context['tagLimit']);
}
else if ($context['tagName'] === 'URL')
{
- $errors[] = $this->user->lang('TOO_MANY_URLS', $context['tagLimit']);
+ $errors[] = array('TOO_MANY_URLS', $context['tagLimit']);
}
}
else if ($msg === 'MAX_FONT_SIZE_EXCEEDED')
{
- $errors[] = $this->user->lang($msg, $context['max_size']);
+ $errors[] = array($msg, $context['max_size']);
}
else if (preg_match('/^MAX_(?:FLASH|IMG)_(HEIGHT|WIDTH)_EXCEEDED$/D', $msg, $m))
{
- $errors[] = $this->user->lang($msg, $context['max_' . strtolower($m[1])]);
+ $errors[] = array($msg, $context['max_' . strtolower($m[1])]);
}
else if ($msg === 'Tag is disabled')
{
$name = strtolower($context['tag']->getName());
- $errors[] = $this->user->lang('UNAUTHORISED_BBCODE', '[' . $name . ']');
+ $errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']');
}
else if ($msg === 'UNABLE_GET_IMAGE_SIZE')
{
- $errors[] = $this->user->lang($msg);
+ $errors[] = array($msg);
}
}