File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ services :
2+ phpbb.googleanalytics.listener :
3+ class : phpbb\googleanalytics\event\listener
4+ arguments :
5+ - @config
6+ - @template
7+ tags :
8+ - { name: event.listener }
Original file line number Diff line number Diff line change 1717*/
1818class listener implements EventSubscriberInterface
1919{
20+ /** @var \phpbb\config\config */
21+ protected $ config ;
22+
23+ /** @var \phpbb\template\template */
24+ protected $ template ;
25+
26+ /**
27+ * Constructor
28+ *
29+ * @param \phpbb\config\config $config Config object
30+ * @param \phpbb\template\template $template Template object
31+ * @return \phpbb\boardrules\event\listener
32+ * @access public
33+ */
34+ public function __construct (\phpbb \config \config $ config , \phpbb \template \template $ template )
35+ {
36+ $ this ->config = $ config ;
37+ $ this ->template = $ template ;
38+ }
39+
40+ /**
41+ * Assign functions defined in this class to event listeners in the core
42+ *
43+ * @return array
44+ * @static
45+ * @access public
46+ */
47+ static public function getSubscribedEvents ()
48+ {
49+ return array (
50+ 'core.common ' => 'load_google_analytics ' ,
51+ );
52+ }
53+
54+ /**
55+ * Load Google Analytics js code
56+ *
57+ * @param object $event The event object
58+ * @return null
59+ * @access public
60+ */
61+ public function load_google_analytics ($ event )
62+ {
63+ $ this ->template ->assign_vars (array (
64+ 'S_GOOGLE_ANALYTICS_ENABLE ' => (!empty ($ this ->config ['googleanalytics ' ])) ? true : false ,
65+ 'GOOGLE_ANALYTICS_ID ' => $ this ->config ['googleanalytics ' ],
66+ ));
67+ }
2068}
You can’t perform that action at this time.
0 commit comments