1 | <?php |
||
21 | class factory |
||
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) |
||
144 | |||
145 | /** |
||
146 | * Extract images from a post and return them as HTML image tags. |
||
147 | * |
||
148 | * @param string $post Post text from the database. |
||
149 | * |
||
150 | * @return string An string of HTML IMG tags. |
||
151 | */ |
||
152 | protected function extract_images($post) |
||
169 | |||
170 | /** |
||
171 | * Is the forum allowed to show topic image previews |
||
172 | * |
||
173 | * @param int $forum_id Forum identifier |
||
174 | * @return bool True if allowed, false if not |
||
175 | */ |
||
176 | protected function forum_allowed($forum_id) |
||
180 | |||
181 | /** |
||
182 | * Does the user allow topic image previews? |
||
183 | * |
||
184 | * @return bool True if allowed, false if not |
||
185 | */ |
||
186 | protected function user_allowed() |
||
190 | |||
191 | /** |
||
192 | * Check if we have post with images |
||
193 | * |
||
194 | * @param \phpbb\event\data $event The event object |
||
195 | * @return bool True if images found in post text, false if not |
||
196 | */ |
||
197 | protected function has_images($event) |
||
201 | } |
||
202 |