1 | <?php |
||
24 | class listener implements EventSubscriberInterface |
||
25 | { |
||
26 | /** @var bbcodes_parser */ |
||
27 | protected $bbcodes_parser; |
||
28 | |||
29 | /** @var bbcodes_display */ |
||
30 | protected $bbcodes_display; |
||
31 | |||
32 | /** @var helper */ |
||
33 | protected $helper; |
||
34 | |||
35 | /** @var template */ |
||
36 | protected $template; |
||
37 | |||
38 | /** @var user */ |
||
39 | protected $user; |
||
40 | |||
41 | /** @var string phpBB root path */ |
||
42 | protected $ext_root_path; |
||
43 | |||
44 | /** |
||
45 | * Constructor |
||
46 | * |
||
47 | * @param bbcodes_parser $bbcodes_parser |
||
48 | * @param bbcodes_display $bbcodes_display |
||
49 | * @param helper $helper |
||
50 | * @param template $template |
||
51 | * @param user $user |
||
52 | * @param string $ext_root_path |
||
53 | * @access public |
||
54 | */ |
||
55 | 22 | public function __construct(bbcodes_parser $bbcodes_parser, bbcodes_display $bbcodes_display, helper $helper, template $template, user $user, $ext_root_path) |
|
64 | |||
65 | /** |
||
66 | * Assign functions defined in this class to event listeners in the core |
||
67 | * |
||
68 | * @return array |
||
69 | * @static |
||
70 | * @access public |
||
71 | */ |
||
72 | 1 | static public function getSubscribedEvents() |
|
94 | |||
95 | /** |
||
96 | * Load common files during user setup |
||
97 | * |
||
98 | * @param \phpbb\event\data $event The event object |
||
99 | * @return null |
||
100 | * @access public |
||
101 | */ |
||
102 | 2 | public function load_language_on_setup($event) |
|
103 | { |
||
104 | 2 | $lang_set_ext = $event['lang_set_ext']; |
|
105 | 2 | $lang_set_ext[] = array( |
|
106 | 2 | 'ext_name' => 'vse/abbc3', |
|
107 | 2 | 'lang_set' => 'abbc3', |
|
108 | ); |
||
109 | 2 | $event['lang_set_ext'] = $lang_set_ext; |
|
110 | 2 | } |
|
111 | |||
112 | /** |
||
113 | * Alter BBCodes before they are processed by phpBB |
||
114 | * |
||
115 | * This is used to change old/malformed ABBC3 BBCodes to a newer structure |
||
116 | * |
||
117 | * @param \phpbb\event\data $event The event object |
||
118 | * @return null |
||
119 | * @access public |
||
120 | */ |
||
121 | 2 | public function parse_bbcodes_before($event) |
|
122 | { |
||
123 | 2 | $event['text'] = $this->bbcodes_parser->pre_parse_bbcodes($event['text'], $event['uid']); |
|
124 | 2 | } |
|
125 | |||
126 | /** |
||
127 | * Alter BBCodes after they are processed by phpBB |
||
128 | * |
||
129 | * This is used on ABBC3 BBCodes that require additional post-processing |
||
130 | * |
||
131 | * @param \phpbb\event\data $event The event object |
||
132 | * @return null |
||
133 | * @access public |
||
134 | */ |
||
135 | 4 | public function parse_bbcodes_after($event) |
|
136 | { |
||
137 | 4 | $event['text'] = $this->bbcodes_parser->post_parse_bbcodes($event['text']); |
|
138 | 4 | } |
|
139 | |||
140 | /** |
||
141 | * Modify the SQL array to gather custom BBCode data |
||
142 | * |
||
143 | * @param \phpbb\event\data $event The event object |
||
144 | * @return null |
||
145 | * @access public |
||
146 | */ |
||
147 | 2 | public function custom_bbcode_modify_sql($event) |
|
148 | { |
||
149 | 2 | $sql_ary = $event['sql_ary']; |
|
150 | 2 | $sql_ary['SELECT'] .= ', b.bbcode_group'; |
|
151 | 2 | $sql_ary['ORDER_BY'] = 'b.bbcode_order, b.bbcode_id'; |
|
152 | 2 | $event['sql_ary'] = $sql_ary; |
|
153 | 2 | } |
|
154 | |||
155 | /** |
||
156 | * Setup custom BBCode variables |
||
157 | * |
||
158 | * @return null |
||
159 | * @access public |
||
160 | */ |
||
161 | 1 | public function setup_custom_bbcodes() |
|
162 | { |
||
163 | 1 | $this->template->assign_vars(array( |
|
164 | 1 | 'ABBC3_USERNAME' => $this->user->data['username'], |
|
165 | 1 | 'ABBC3_BBCODE_ICONS' => $this->ext_root_path . 'images/icons', |
|
166 | 1 | 'ABBC3_BBVIDEO_HEIGHT' => ext::BBVIDEO_HEIGHT, |
|
167 | 1 | 'ABBC3_BBVIDEO_WIDTH' => ext::BBVIDEO_WIDTH, |
|
168 | |||
169 | 1 | 'UA_ABBC3_BBVIDEO_WIZARD' => $this->helper->route('vse_abbc3_bbcode_wizard', array('mode' => 'bbvideo')), |
|
170 | 1 | 'UA_ABBC3_URL_WIZARD' => $this->helper->route('vse_abbc3_bbcode_wizard', array('mode' => 'url')), |
|
171 | 1 | )); |
|
172 | 1 | } |
|
173 | |||
174 | /** |
||
175 | * Alter custom BBCodes display |
||
176 | * |
||
177 | * @param \phpbb\event\data $event The event object |
||
178 | * @return null |
||
179 | * @access public |
||
180 | */ |
||
181 | 4 | public function display_custom_bbcodes($event) |
|
182 | { |
||
183 | 4 | $event['custom_tags'] = $this->bbcodes_display->display_custom_bbcodes($event['custom_tags'], $event['row']); |
|
184 | 4 | } |
|
185 | |||
186 | /** |
||
187 | * Set custom BBCodes permissions |
||
188 | * |
||
189 | * @param \phpbb\event\data $event The event object |
||
190 | * @return null |
||
191 | * @access public |
||
192 | * |
||
193 | * @deprecated 3.2.0. Provides bc for phpBB 3.1.x. |
||
194 | */ |
||
195 | public function allow_custom_bbcodes($event) |
||
196 | { |
||
197 | $event['bbcodes'] = $this->bbcodes_display->allow_custom_bbcodes($event['bbcodes'], $event['rowset']); |
||
|
|||
198 | } |
||
199 | |||
200 | /** |
||
201 | * Toggle custom BBCodes in the s9e\TextFormatter parser based on user's group memberships |
||
202 | * |
||
203 | * @param \phpbb\event\data $event The event object |
||
204 | * @return null |
||
205 | * @access public |
||
206 | */ |
||
207 | 2 | public function s9e_allow_custom_bbcodes($event) |
|
226 | } |
||
227 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.