1 | <?php |
||
13 | class display extends base |
||
14 | { |
||
15 | /** @var int default width of topic preview */ |
||
16 | const PREVIEW_SIZE = 360; |
||
17 | |||
18 | /** @var int default height and width of topic preview avatars */ |
||
19 | const AVATAR_SIZE = 60; |
||
20 | |||
21 | /** @var \phpbb\event\dispatcher_interface */ |
||
22 | protected $dispatcher; |
||
23 | |||
24 | /** @var \phpbb\template\template */ |
||
25 | protected $template; |
||
26 | |||
27 | /** @var string phpBB root path */ |
||
28 | protected $root_path; |
||
29 | |||
30 | /** @var \vse\topicpreview\core\trim\trim */ |
||
31 | protected $trim; |
||
32 | |||
33 | /** |
||
34 | * Constructor |
||
35 | * |
||
36 | * @param \phpbb\config\config $config Config object |
||
37 | * @param \phpbb\event\dispatcher_interface $dispatcher Event dispatcher object |
||
38 | * @param \phpbb\template\template $template Template object |
||
39 | * @param \vse\topicpreview\core\trim\trim $trim Trim text object |
||
40 | * @param \phpbb\user $user User object |
||
41 | * @param string $root_path |
||
42 | */ |
||
43 | 9 | public function __construct(\phpbb\config\config $config, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\template\template $template, \vse\topicpreview\core\trim\trim $trim, \phpbb\user $user, $root_path) |
|
53 | |||
54 | /** |
||
55 | * Set up some common components |
||
56 | * |
||
57 | * @return null |
||
58 | */ |
||
59 | 9 | public function setup() |
|
75 | |||
76 | /** |
||
77 | * Inject topic preview text into the template |
||
78 | * |
||
79 | * @param array $row Row data |
||
80 | * @param array $block Template vars array |
||
81 | * @return array Template vars array |
||
82 | */ |
||
83 | 6 | public function display_topic_preview($row, $block) |
|
113 | |||
114 | /** |
||
115 | * Get topic preview text helper function |
||
116 | * This handles the trimming and censoring |
||
117 | * |
||
118 | * @param array $row User row data |
||
119 | * @param string $post The first or last post text column key |
||
120 | * @return string The trimmed and censored topic preview text |
||
121 | */ |
||
122 | 5 | protected function get_text_helper($row, $post) |
|
132 | |||
133 | /** |
||
134 | * Get user avatar helper function |
||
135 | * |
||
136 | * @param array $row User row data |
||
137 | * @param string $poster Type of poster, fp or lp |
||
138 | * @return string Avatar image |
||
139 | */ |
||
140 | 5 | protected function get_user_avatar_helper($row, $poster) |
|
163 | |||
164 | /** |
||
165 | * Get user's style topic preview theme |
||
166 | * Fall back to no theme if expected theme not found |
||
167 | * |
||
168 | * @return mixed Theme name if theme file found, false otherwise |
||
169 | */ |
||
170 | 9 | protected function get_theme() |
|
182 | } |
||
183 |