aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textformatter
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/textformatter')
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php43
1 files changed, 30 insertions, 13 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 1e85856898..c0bbc7b0e8 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -132,6 +132,11 @@ class factory implements \phpbb\textformatter\cache_interface
protected $dispatcher;
/**
+ * @var \phpbb\log\log_interface
+ */
+ protected $log;
+
+ /**
* Constructor
*
* @param \phpbb\textformatter\data_access $data_access
@@ -139,11 +144,12 @@ class factory implements \phpbb\textformatter\cache_interface
* @param \phpbb\event\dispatcher_interface $dispatcher
* @param \phpbb\config\config $config
* @param \phpbb\textformatter\s9e\link_helper $link_helper
+ * @param \phpbb\log\log_interface $log
* @param string $cache_dir Path to the cache dir
* @param string $cache_key_parser Cache key used for the parser
* @param string $cache_key_renderer Cache key used for the renderer
*/
- public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer)
+ public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, \phpbb\log\log_interface $log, $cache_dir, $cache_key_parser, $cache_key_renderer)
{
$this->link_helper = $link_helper;
$this->cache = $cache;
@@ -153,6 +159,7 @@ class factory implements \phpbb\textformatter\cache_interface
$this->config = $config;
$this->data_access = $data_access;
$this->dispatcher = $dispatcher;
+ $this->log = $log;
}
/**
@@ -272,7 +279,7 @@ class factory implements \phpbb\textformatter\cache_interface
// Add default BBCodes
foreach ($this->get_default_bbcodes($configurator) as $bbcode)
{
- $configurator->BBCodes->addCustom($bbcode['usage'], new UnsafeTemplate($bbcode['template']));
+ $this->add_bbcode($configurator, $bbcode['usage'], $bbcode['template']);
}
if (isset($configurator->tags['QUOTE']))
{
@@ -299,17 +306,7 @@ class factory implements \phpbb\textformatter\cache_interface
},
$row['bbcode_tpl']
);
-
- try
- {
- $configurator->BBCodes->addCustom($row['bbcode_match'], new UnsafeTemplate($tpl));
- }
- catch (\Exception $e)
- {
- /**
- * @todo log an error?
- */
- }
+ $this->add_bbcode($configurator, $row['bbcode_match'], $tpl);
}
// Load smilies
@@ -419,6 +416,26 @@ class factory implements \phpbb\textformatter\cache_interface
}
/**
+ * Add a BBCode to given configurator
+ *
+ * @param Configurator $configurator
+ * @param string $usage
+ * @param string $template
+ * @return void
+ */
+ protected function add_bbcode(Configurator $configurator, $usage, $template)
+ {
+ try
+ {
+ $configurator->BBCodes->addCustom($usage, new UnsafeTemplate($template));
+ }
+ catch (\Exception $e)
+ {
+ $this->log->add('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, [$usage, $e->getMessage()]);
+ }
+ }
+
+ /**
* Configure the Autolink / Autoemail plugins used to linkify text
*
* @param \s9e\TextFormatter\Configurator $configurator