1 | <?php |
||
21 | class helper |
||
22 | { |
||
23 | /** @var auth */ |
||
24 | protected $auth; |
||
25 | |||
26 | /** @var config */ |
||
27 | protected $config; |
||
28 | |||
29 | /** @var driver_interface */ |
||
30 | protected $db; |
||
31 | |||
32 | /** @var user */ |
||
33 | protected $user; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | * @param auth $auth |
||
39 | * @param config $config |
||
40 | * @param driver_interface $db |
||
41 | * @param user $user |
||
42 | */ |
||
43 | public function __construct(auth $auth, config $config, driver_interface $db, user $user) |
||
50 | |||
51 | /** |
||
52 | * Add post text containing images to topic row data. |
||
53 | * |
||
54 | * @param \phpbb\event\data $event The event object |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | public function update_row_data($event) |
||
73 | |||
74 | /** |
||
75 | * Add image previews to the template data. |
||
76 | * |
||
77 | * @param \phpbb\event\data $event The event object |
||
78 | * |
||
79 | * @return void |
||
80 | */ |
||
81 | public function update_tpl_data($event) |
||
92 | |||
93 | /** |
||
94 | * Run an SQL query on a group of topics, and find the newest (or oldest) |
||
95 | * post with [IMG] images. Then update the topic's row set array to include |
||
96 | * the post's text in the cases where images were found. |
||
97 | * |
||
98 | * @param array $topic_list An array of topic ids |
||
99 | * @param array $rowset The row set of topic data |
||
100 | * |
||
101 | * @return array The updated row set of topic data which now includes |
||
102 | * the post_text of a post containing images. |
||
103 | */ |
||
104 | protected function query_images(array $topic_list, array $rowset) |
||
146 | |||
147 | /** |
||
148 | * Extract images from a post and return them as HTML image tags. |
||
149 | * |
||
150 | * @param string $post Post text from the database. |
||
151 | * |
||
152 | * @return string An string of HTML IMG tags. |
||
153 | */ |
||
154 | protected function extract_images($post) |
||
171 | |||
172 | /** |
||
173 | * Is the forum allowed to show topic image previews |
||
174 | * |
||
175 | * @param int $forum_id Forum identifier |
||
176 | * @return bool True if allowed, false if not |
||
177 | */ |
||
178 | protected function forum_allowed($forum_id) |
||
182 | |||
183 | /** |
||
184 | * Does the user allow topic image previews? |
||
185 | * |
||
186 | * @return bool True if allowed, false if not |
||
187 | */ |
||
188 | protected function user_allowed() |
||
192 | } |
||
193 |