From 221e5a01b1cf3369fcb7807c30a8f05ead20076d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 28 Sep 2017 23:55:28 +0200 Subject: [ticket/15245] Fix comments, class names and code style PHPBB3-15245 --- phpBB/phpbb/feed/feed_quote_helper.php | 35 --------------------------------- phpBB/phpbb/feed/helper.php | 33 ++++++++++++++++++++----------- phpBB/phpbb/feed/quote_helper.php | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 46 deletions(-) delete mode 100644 phpBB/phpbb/feed/feed_quote_helper.php create mode 100644 phpBB/phpbb/feed/quote_helper.php (limited to 'phpBB/phpbb/feed') diff --git a/phpBB/phpbb/feed/feed_quote_helper.php b/phpBB/phpbb/feed/feed_quote_helper.php deleted file mode 100644 index 02a9b35dc0..0000000000 --- a/phpBB/phpbb/feed/feed_quote_helper.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @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\feed; - -/** - * Modified quote_helper for feeds (basically just removing all attributes) - */ -class feed_quote_helper extends \phpbb\textformatter\s9e\quote_helper -{ - /** - * {@inheritdoc} - */ - public function inject_metadata($xml) - { - // In feeds we don't want any attributes, so delete all of them - return \s9e\TextFormatter\Utils::replaceAttributes( - $xml, - 'QUOTE', - function () { - return []; - } - ); - } -} diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index df7388331c..7d50b7ce7d 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -13,41 +13,52 @@ namespace phpbb\feed; +use phpbb\config\config; +use phpbb\path_helper; +use phpbb\textformatter\s9e\renderer; +use phpbb\user; +use Symfony\Component\DependencyInjection\ContainerInterface; + /** * Class with some helpful functions used in feeds */ class helper { - /** @var \phpbb\config\config */ + /** @var config */ protected $config; - /** @var \phpbb\path_helper */ + /** @var ContainerInterface */ + protected $container; + + /** @var path_helper */ protected $path_helper; - /** @var \phpbb\textformatter\s9e\renderer */ + /** @var renderer */ protected $renderer; - /** @var \phpbb\user */ + /** @var user */ protected $user; /** * Constructor * - * @param \phpbb\config\config $config Config object - * @param \phpbb\path_helper $path_helper Path helper object - * @param \phpbb\textformatter\s9e\renderer $renderer TextFormatter renderer object - * @param \phpbb\user $user User object + * @param config $config Config object + * @param ContainerInterface $container Service container object + * @param path_helper $path_helper Path helper object + * @param renderer $renderer TextFormatter renderer object + * @param user $user User object */ - public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\textformatter\s9e\renderer $renderer, \phpbb\user $user) + public function __construct(config $config, ContainerInterface $container, path_helper $path_helper, renderer $renderer, user $user) { $this->config = $config; + $this->container = $container; $this->path_helper = $path_helper; $this->renderer = $renderer; $this->user = $user; } /** - * Run links through append_sid(), prepend generate_board_url() and remove session id + * Returns the board url (and caches it in the function) */ public function get_board_url() { @@ -105,7 +116,7 @@ class helper } // Setup our own quote_helper to remove all attributes from quotes - $this->renderer->configure_quote_helper(new feed_quote_helper($this->user, $this->path_helper->get_phpbb_root_path(), $this->path_helper->get_php_ext())); + $this->renderer->configure_quote_helper($this->container->get('feed.quote_helper')); $this->renderer->set_smilies_path($this->get_board_url() . '/' . $this->config['smilies_path']); diff --git a/phpBB/phpbb/feed/quote_helper.php b/phpBB/phpbb/feed/quote_helper.php new file mode 100644 index 0000000000..843d075028 --- /dev/null +++ b/phpBB/phpbb/feed/quote_helper.php @@ -0,0 +1,36 @@ + + * @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\feed; + +/** + * Modified quote_helper for feeds (basically just removing all attributes) + */ +class quote_helper extends \phpbb\textformatter\s9e\quote_helper +{ + /** + * {@inheritdoc} + */ + public function inject_metadata($xml) + { + // In feeds we don't want any attributes, so delete all of them + return \s9e\TextFormatter\Utils::replaceAttributes( + $xml, + 'QUOTE', + function () + { + return []; + } + ); + } +} -- cgit v1.2.1