[ticket/12787] Add controller_helper::get_current_url()

PHPBB3-12787
This commit is contained in:
Tristan Darricau 2014-07-08 00:04:11 +02:00
parent 7399f29df8
commit 9374d14e27
2 changed files with 17 additions and 1 deletions

View file

@ -96,6 +96,7 @@ services:
- @config - @config
- @controller.provider - @controller.provider
- @ext.manager - @ext.manager
- @symfony_request
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%

View file

@ -40,6 +40,9 @@ class helper
*/ */
protected $config; protected $config;
/* @var \phpbb\symfony_request */
protected $symfony_request;
/** /**
* phpBB root path * phpBB root path
* @var string * @var string
@ -60,14 +63,16 @@ class helper
* @param \phpbb\config\config $config Config object * @param \phpbb\config\config $config Config object
* @param \phpbb\controller\provider $provider Path provider * @param \phpbb\controller\provider $provider Path provider
* @param \phpbb\extension\manager $manager Extension manager object * @param \phpbb\extension\manager $manager Extension manager object
* @param \phpbb\symfony_request $symfony_request Symfony Request object
* @param string $phpbb_root_path phpBB root path * @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP extension * @param string $php_ext PHP extension
*/ */
public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, $phpbb_root_path, $php_ext) public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext)
{ {
$this->template = $template; $this->template = $template;
$this->user = $user; $this->user = $user;
$this->config = $config; $this->config = $config;
$this->symfony_request = $symfony_request;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$provider->find_routing_files($manager->get_finder()); $provider->find_routing_files($manager->get_finder());
@ -151,4 +156,14 @@ class helper
return $this->render('message_body.html', $this->user->lang('INFORMATION'), $code); return $this->render('message_body.html', $this->user->lang('INFORMATION'), $code);
} }
/**
* Return the current url
*
* @return string
*/
public function get_current_url()
{
return generate_board_url(true) . $this->symfony_request->getRequestUri();
}
} }