aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-03-06 10:21:15 +0100
committerJoshyPHP <s9e.dev@gmail.com>2015-04-02 19:16:03 +0200
commit8411db62576a73beb921d58953bb5b767d4ee079 (patch)
tree4149b9f4b151f82f967b904b86894c0c4d234097
parentec77ff7838e317deb5facacfae31402af08a9902 (diff)
downloadforums-8411db62576a73beb921d58953bb5b767d4ee079.tar
forums-8411db62576a73beb921d58953bb5b767d4ee079.tar.gz
forums-8411db62576a73beb921d58953bb5b767d4ee079.tar.bz2
forums-8411db62576a73beb921d58953bb5b767d4ee079.tar.xz
forums-8411db62576a73beb921d58953bb5b767d4ee079.zip
[ticket/11768] Renamed interfaces
PHPBB3-11768
-rw-r--r--phpBB/phpbb/textformatter/cache_interface.php (renamed from phpBB/phpbb/textformatter/cache.php)2
-rw-r--r--phpBB/phpbb/textformatter/data_access.php2
-rw-r--r--phpBB/phpbb/textformatter/parser_interface.php (renamed from phpBB/phpbb/textformatter/parser.php)2
-rw-r--r--phpBB/phpbb/textformatter/renderer.php129
-rw-r--r--phpBB/phpbb/textformatter/renderer_interface.php92
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php2
-rw-r--r--phpBB/phpbb/textformatter/s9e/parser.php2
-rw-r--r--phpBB/phpbb/textformatter/s9e/renderer.php35
8 files changed, 129 insertions, 137 deletions
diff --git a/phpBB/phpbb/textformatter/cache.php b/phpBB/phpbb/textformatter/cache_interface.php
index a2f7ff7d7b..f6b5f195c7 100644
--- a/phpBB/phpbb/textformatter/cache.php
+++ b/phpBB/phpbb/textformatter/cache_interface.php
@@ -17,7 +17,7 @@ namespace phpbb\textformatter;
* Currently only used to signal that something that could effect the rendering has changed.
* BBCodes, smilies, censored words, templates, etc...
*/
-interface cache
+interface cache_interface
{
/**
* Invalidate and/or regenerate this text formatter's cache(s)
diff --git a/phpBB/phpbb/textformatter/data_access.php b/phpBB/phpbb/textformatter/data_access.php
index bc33791e15..2dfba27960 100644
--- a/phpBB/phpbb/textformatter/data_access.php
+++ b/phpBB/phpbb/textformatter/data_access.php
@@ -27,7 +27,7 @@ class data_access
protected $bbcodes_table;
/**
- * @var \phpbb_db_driver
+ * @var \phpbb_db_driver_interface
*/
protected $db;
diff --git a/phpBB/phpbb/textformatter/parser.php b/phpBB/phpbb/textformatter/parser_interface.php
index 922226cf44..37d538470d 100644
--- a/phpBB/phpbb/textformatter/parser.php
+++ b/phpBB/phpbb/textformatter/parser_interface.php
@@ -13,7 +13,7 @@
namespace phpbb\textformatter;
-interface parser
+interface parser_interface
{
/**
* Parse given text
diff --git a/phpBB/phpbb/textformatter/renderer.php b/phpBB/phpbb/textformatter/renderer.php
deleted file mode 100644
index d3594bb4ae..0000000000
--- a/phpBB/phpbb/textformatter/renderer.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-namespace phpbb\textformatter;
-
-abstract class renderer
-{
- /**
- * Render given text
- *
- * @param string $text Text, as parsed by something that implements \phpbb\textformatter\parser
- * @return string
- */
- abstract public function render($text);
-
- /**
- * Automatically set the smilies path based on config
- *
- * @param \phpbb\config\config $config
- * @param \phpbb\path_helper $path_helper
- * @return null
- */
- public function configure_smilies_path(\phpbb\config\config $config, \phpbb\path_helper $path_helper)
- {
- /**
- * @see smiley_text()
- */
- $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $path_helper->get_web_root_path();
-
- $this->set_smilies_path($root_path . $config['smilies_path']);
- }
-
- /**
- * Configure this renderer as per the user's settings
- *
- * Should set the locale as well as the viewcensor/viewflash/viewimg/viewsmilies options.
- *
- * @param \phpbb\user $user
- * @param \phpbb\config\config $config
- * @param \phpbb\auth\auth $auth
- * @return null
- */
- public function configure_user(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth)
- {
- $censor = $user->optionget('viewcensors') || !$config['allow_nocensors'] || !$auth->acl_get('u_chgcensors');
-
- $this->set_viewcensors($censor);
- $this->set_viewflash($user->optionget('viewflash'));
- $this->set_viewimg($user->optionget('viewimg'));
- $this->set_viewsmilies($user->optionget('viewsmilies'));
- }
-
- /**
- * Set the smilies' path
- *
- * @return null
- */
- abstract public function set_smilies_path($path);
-
- /**
- * Return the value of the "viewcensors" option
- *
- * @return bool Option's value
- */
- abstract public function get_viewcensors();
-
- /**
- * Return the value of the "viewflash" option
- *
- * @return bool Option's value
- */
- abstract public function get_viewflash();
-
- /**
- * Return the value of the "viewimg" option
- *
- * @return bool Option's value
- */
- abstract public function get_viewimg();
-
- /**
- * Return the value of the "viewsmilies" option
- *
- * @return bool Option's value
- */
- abstract public function get_viewsmilies();
-
- /**
- * Set the "viewcensors" option
- *
- * @param bool $value Option's value
- * @return null
- */
- abstract public function set_viewcensors($value);
-
- /**
- * Set the "viewflash" option
- *
- * @param bool $value Option's value
- * @return null
- */
- abstract public function set_viewflash($value);
-
- /**
- * Set the "viewimg" option
- *
- * @param bool $value Option's value
- * @return null
- */
- abstract public function set_viewimg($value);
-
- /**
- * Set the "viewsmilies" option
- *
- * @param bool $value Option's value
- * @return null
- */
- abstract public function set_viewsmilies($value);
-}
diff --git a/phpBB/phpbb/textformatter/renderer_interface.php b/phpBB/phpbb/textformatter/renderer_interface.php
new file mode 100644
index 0000000000..609b0bb642
--- /dev/null
+++ b/phpBB/phpbb/textformatter/renderer_interface.php
@@ -0,0 +1,92 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\textformatter;
+
+interface renderer_interface
+{
+ /**
+ * Render given text
+ *
+ * @param string $text Text, as parsed by something that implements \phpbb\textformatter\parser
+ * @return string
+ */
+ public function render($text);
+
+ /**
+ * Set the smilies' path
+ *
+ * @return null
+ */
+ public function set_smilies_path($path);
+
+ /**
+ * Return the value of the "viewcensors" option
+ *
+ * @return bool Option's value
+ */
+ public function get_viewcensors();
+
+ /**
+ * Return the value of the "viewflash" option
+ *
+ * @return bool Option's value
+ */
+ public function get_viewflash();
+
+ /**
+ * Return the value of the "viewimg" option
+ *
+ * @return bool Option's value
+ */
+ public function get_viewimg();
+
+ /**
+ * Return the value of the "viewsmilies" option
+ *
+ * @return bool Option's value
+ */
+ public function get_viewsmilies();
+
+ /**
+ * Set the "viewcensors" option
+ *
+ * @param bool $value Option's value
+ * @return null
+ */
+ public function set_viewcensors($value);
+
+ /**
+ * Set the "viewflash" option
+ *
+ * @param bool $value Option's value
+ * @return null
+ */
+ public function set_viewflash($value);
+
+ /**
+ * Set the "viewimg" option
+ *
+ * @param bool $value Option's value
+ * @return null
+ */
+ public function set_viewimg($value);
+
+ /**
+ * Set the "viewsmilies" option
+ *
+ * @param bool $value Option's value
+ * @return null
+ */
+ public function set_viewsmilies($value);
+}
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 9327da4b4f..aa37beeef6 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -20,7 +20,7 @@ use s9e\TextFormatter\Configurator\Items\UnsafeTemplate;
/**
* Creates s9e\TextFormatter objects
*/
-class factory implements \phpbb\textformatter\cache
+class factory implements \phpbb\textformatter\cache_interface
{
/**
* @var \phpbb\cache\driver_interface $cache
diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php
index be717bb1c9..4775175f73 100644
--- a/phpBB/phpbb/textformatter/s9e/parser.php
+++ b/phpBB/phpbb/textformatter/s9e/parser.php
@@ -19,7 +19,7 @@ use s9e\TextFormatter\Parser\Logger;
/**
* s9e\TextFormatter\Parser adapter
*/
-class parser implements \phpbb\textformatter\parser
+class parser implements \phpbb\textformatter\parser_interface
{
/**
* @var \s9e\TextFormatter\Parser
diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php
index 5468af450f..0b3c63fb91 100644
--- a/phpBB/phpbb/textformatter/s9e/renderer.php
+++ b/phpBB/phpbb/textformatter/s9e/renderer.php
@@ -16,7 +16,7 @@ namespace phpbb\textformatter\s9e;
/**
* s9e\TextFormatter\Renderer adapter
*/
-class renderer extends \phpbb\textformatter\renderer
+class renderer implements \phpbb\textformatter\renderer_interface
{
/**
* @var \s9e\TextFormatter\Plugins\Censor\Helper
@@ -101,11 +101,40 @@ class renderer extends \phpbb\textformatter\renderer
}
/**
- * {@inheritdoc}
+ * Automatically set the smilies path based on config
+ *
+ * @param \phpbb\config\config $config
+ * @param \phpbb\path_helper $path_helper
+ * @return null
+ */
+ public function configure_smilies_path(\phpbb\config\config $config, \phpbb\path_helper $path_helper)
+ {
+ /**
+ * @see smiley_text()
+ */
+ $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $path_helper->get_web_root_path();
+
+ $this->set_smilies_path($root_path . $config['smilies_path']);
+ }
+
+ /**
+ * Configure this renderer as per the user's settings
+ *
+ * Should set the locale as well as the viewcensor/viewflash/viewimg/viewsmilies options.
+ *
+ * @param \phpbb\user $user
+ * @param \phpbb\config\config $config
+ * @param \phpbb\auth\auth $auth
+ * @return null
*/
public function configure_user(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth)
{
- parent::configure_user($user, $config, $auth);
+ $censor = $user->optionget('viewcensors') || !$config['allow_nocensors'] || !$auth->acl_get('u_chgcensors');
+
+ $this->set_viewcensors($censor);
+ $this->set_viewflash($user->optionget('viewflash'));
+ $this->set_viewimg($user->optionget('viewimg'));
+ $this->set_viewsmilies($user->optionget('viewsmilies'));
// Set the stylesheet parameters
foreach (array_keys($this->renderer->getParameters()) as $param_name)