myextension/event/listener.php
Cod: Selectaţi tot
<?php
/**
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace phpbb\myextension\event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\config\db_text */
protected $config_text;
/** @var \phpbb\controller\helper */
protected $controller_helper;
/** @var \phpbb\request\request */
protected $request;
/** @var \phpbb\template\template */
protected $template;
/** @var \phpbb\user */
protected $user;
public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\controller\helper $controller_helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
{
$this->config = $config;
$this->config_text = $config_text;
$this->controller_helper = $controller_helper;
$this->request = $request;
$this->template = $template;
$this->user = $user;
}
/**
* Assign functions defined in this class to event listeners in the core
*
* @return array
* @static
* @access public
*/
static public function getSubscribedEvents()
{
return array(
'navbar_header_logged_out_content' => 'mycriptiframe',
);
}
public function mycriptiframe($event)
{
$this->template->assign_vars(array(
'TEST' => 'test',
));
}
}
Cod: Selectaţi tot
{TEST}