diff options
author | Marc Alexander <admin@m-a-styles.de> | 2016-07-17 22:09:53 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2016-07-17 22:09:53 +0200 |
commit | e7ce7ecbe79b036a9cf7dab9ea343efd0d47e1a7 (patch) | |
tree | f2167925ff269870b6a3b3dc00b79e881a3dafbb /phpBB/phpbb | |
parent | 4e480d46f50efad546e3515e52457f2ee0efad35 (diff) | |
parent | befacabf7e105ff81b2b5c0c2361aa1e32ed5b84 (diff) | |
download | forums-e7ce7ecbe79b036a9cf7dab9ea343efd0d47e1a7.tar forums-e7ce7ecbe79b036a9cf7dab9ea343efd0d47e1a7.tar.gz forums-e7ce7ecbe79b036a9cf7dab9ea343efd0d47e1a7.tar.bz2 forums-e7ce7ecbe79b036a9cf7dab9ea343efd0d47e1a7.tar.xz forums-e7ce7ecbe79b036a9cf7dab9ea343efd0d47e1a7.zip |
Merge branch '3.1.x' into 3.2.x
Conflicts:
phpBB/config/feed.yml
phpBB/feed.php
phpBB/phpbb/feed/base.php
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/feed/base.php | 35 | ||||
-rw-r--r-- | phpBB/phpbb/feed/controller/feed.php | 24 |
2 files changed, 57 insertions, 2 deletions
diff --git a/phpBB/phpbb/feed/base.php b/phpBB/phpbb/feed/base.php index 188d229515..d4be0dc592 100644 --- a/phpBB/phpbb/feed/base.php +++ b/phpBB/phpbb/feed/base.php @@ -39,6 +39,12 @@ abstract class base implements feed_interface /** @var \phpbb\auth\auth */ protected $auth; + /** @var \phpbb\content_visibility */ + protected $content_visibility; + + /** @var \phpbb\event\dispatcher_interface */ + protected $phpbb_dispatcher; + /** @var string */ protected $phpEx; @@ -80,9 +86,20 @@ abstract class base implements feed_interface * @param \phpbb\user $user User object * @param \phpbb\auth\auth $auth Auth object * @param \phpbb\content_visibility $content_visibility Auth object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object * @param string $phpEx php file extension */ - public function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx) + public function __construct( + \phpbb\feed\helper $helper, + \phpbb\config\config $config, + \phpbb\db\driver\driver_interface $db, + \phpbb\cache\driver\driver_interface $cache, + \phpbb\user $user, + \phpbb\auth\auth $auth, + \phpbb\content_visibility $content_visibility, + \phpbb\event\dispatcher_interface $phpbb_dispatcher, + $phpEx + ) { $this->config = $config; $this->helper = $helper; @@ -91,6 +108,7 @@ abstract class base implements feed_interface $this->user = $user; $this->auth = $auth; $this->content_visibility = $content_visibility; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->phpEx = $phpEx; $this->set_keys(); @@ -161,6 +179,21 @@ abstract class base implements feed_interface return false; } + $sql_ary = $this->sql; + + /** + * Event to modify the feed item sql + * + * @event core.feed_base_modify_item_sql + * @var array sql_ary The SQL array to get the feed item data + * + * @since 3.1.10-RC1 + */ + $vars = array('sql_ary'); + extract($this->phpbb_dispatcher->trigger_event('core.feed_base_modify_item_sql', compact($vars))); + $this->sql = $sql_ary; + unset($sql_ary); + // Query database $sql = $this->db->sql_build_query('SELECT', $this->sql); $this->result = $this->db->sql_query_limit($sql, $this->num_items); diff --git a/phpBB/phpbb/feed/controller/feed.php b/phpBB/phpbb/feed/controller/feed.php index 31476b7317..c0d7bc72ec 100644 --- a/phpBB/phpbb/feed/controller/feed.php +++ b/phpBB/phpbb/feed/controller/feed.php @@ -16,6 +16,7 @@ namespace phpbb\feed\controller; use phpbb\auth\auth; use phpbb\config\config; use phpbb\db\driver\driver_interface; +use \phpbb\event\dispatcher_interface; use phpbb\exception\http_exception; use phpbb\feed\feed_interface; use phpbb\feed\exception\feed_unavailable_exception; @@ -76,6 +77,11 @@ class feed protected $auth; /** + * @var dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * @var string */ protected $php_ext; @@ -92,9 +98,10 @@ class feed * @param feed_helper $feed_helper * @param user $user * @param auth $auth + * @param dispatcher_interface $phpbb_dispatcher * @param string $php_ext */ - public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, $php_ext) + public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) { $this->request = $request; $this->controller_helper = $controller_helper; @@ -106,6 +113,7 @@ class feed $this->auth = $auth; $this->php_ext = $php_ext; $this->template = $twig; + $this->phpbb_dispatcher = $phpbb_dispatcher; } /** @@ -296,6 +304,20 @@ class feed // Iterate through items while ($row = $feed->get_item()) { + /** + * Event to modify the feed row + * + * @event core.feed_modify_feed_row + * @var int forum_id Forum ID + * @var string mode Feeds mode (forums|topics|topics_new|topics_active|news) + * @var array row Array with feed data + * @var int topic_id Topic ID + * + * @since 3.1.10-RC1 + */ + $vars = array('forum_id', 'mode', 'row', 'topic_id'); + extract($this->phpbb_dispatcher->trigger_event('core.feed_modify_feed_row', compact($vars))); + // BBCode options to correctly disable urls, smilies, bbcode... if ($feed->get('options') === null) { |