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 | /** @var bool */ |
||
36 | protected $preview = false; |
||
37 | |||
38 | /** |
||
39 | * Constructor |
||
40 | * |
||
41 | * @param auth $auth |
||
42 | * @param config $config |
||
43 | * @param driver_interface $db |
||
44 | * @param user $user |
||
45 | */ |
||
46 | public function __construct(auth $auth, config $config, driver_interface $db, user $user) |
||
53 | |||
54 | /** |
||
55 | * Get the value of the in_preview |
||
56 | * |
||
57 | * @return bool True if topic image previews are generated. |
||
58 | */ |
||
59 | public function is_preview() |
||
63 | |||
64 | /** |
||
65 | * Add post text containing images to topic row data. |
||
66 | * |
||
67 | * @param \phpbb\event\data $event The event object |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | public function update_row_data($event) |
||
86 | |||
87 | /** |
||
88 | * Add image previews to the template data. |
||
89 | * |
||
90 | * @param \phpbb\event\data $event The event object |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | public function update_tpl_data($event) |
||
107 | |||
108 | /** |
||
109 | * Run an SQL query on a group of topics, and find the newest (or oldest) |
||
110 | * post with [IMG] images. Then update the topic's row set array to include |
||
111 | * the post's text in the cases where images were found. |
||
112 | * |
||
113 | * @param array $topic_list An array of topic ids |
||
114 | * @param array $rowset The row set of topic data |
||
115 | * |
||
116 | * @return array The updated row set of topic data which now includes |
||
117 | * the post_text of a post containing images. |
||
118 | */ |
||
119 | protected function query_images(array $topic_list, array $rowset) |
||
161 | |||
162 | /** |
||
163 | * Extract images from a post and return them as HTML image tags. |
||
164 | * |
||
165 | * @param string $post Post text from the database. |
||
166 | * |
||
167 | * @return string An string of HTML IMG tags. |
||
168 | */ |
||
169 | protected function extract_images($post) |
||
186 | |||
187 | /** |
||
188 | * Is the forum allowed to show topic image previews |
||
189 | * |
||
190 | * @param int $forum_id Forum identifier |
||
191 | * @return bool True if allowed, false if not |
||
192 | */ |
||
193 | protected function forum_allowed($forum_id) |
||
197 | |||
198 | /** |
||
199 | * Does the user allow topic image previews? |
||
200 | * |
||
201 | * @return bool True if allowed, false if not |
||
202 | */ |
||
203 | protected function user_allowed() |
||
207 | } |
||
208 |