1 | <?php |
||
12 | class wordgraph extends \blitze\sitemaker\services\blocks\driver\block |
||
13 | { |
||
14 | /** @var \phpbb\auth\auth */ |
||
15 | protected $auth; |
||
16 | |||
17 | /** @var \phpbb\content_visibility */ |
||
18 | protected $content_visibility; |
||
19 | |||
20 | /** @var \phpbb\db\driver\driver_interface */ |
||
21 | protected $db; |
||
22 | |||
23 | /** @var \phpbb\user */ |
||
24 | protected $user; |
||
25 | |||
26 | /** @var string */ |
||
27 | protected $phpbb_root_path; |
||
28 | |||
29 | /** @var string */ |
||
30 | protected $php_ext; |
||
31 | |||
32 | /** |
||
33 | * Constructor |
||
34 | * |
||
35 | * @param \phpbb\auth\auth $auth Auth object |
||
36 | * @param \phpbb\content_visibility $content_visibility Content visibility |
||
37 | * @param \phpbb\db\driver\driver_interface $db Database connection |
||
38 | * @param \phpbb\user $user User object |
||
39 | * @param string $phpbb_root_path phpBB root path |
||
40 | * @param string $php_ext phpEx |
||
41 | */ |
||
42 | public function __construct(\phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function get_config(array $settings) |
||
56 | { |
||
57 | return array( |
||
58 | 'legend1' => $this->user->lang('SETTINGS'), |
||
59 | 'show_word_count' => array('lang' => 'SHOW_WORD_COUNT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false, 'default' => 0), |
||
60 | 'max_num_words' => array('lang' => 'MAX_WORDS', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'maxlength' => 2, 'explain' => false, 'default' => 15), |
||
61 | 'max_word_size' => array('lang' => 'WORD_MAX_SIZE', 'validate' => 'int:0:55', 'type' => 'number:0:55', 'maxlength' => 2, 'explain' => false, 'default' => 25, 'append' => 'PIXEL'), |
||
62 | 'min_word_size' => array('lang' => 'WORD_MIN_SIZE', 'validate' => 'int:0:20', 'type' => 'number:0:20', 'maxlength' => 2, 'explain' => false, 'default' => 9, 'append' => 'PIXEL'), |
||
63 | 'exclude_words' => array('lang' => 'EXCLUDE_WORDS', 'validate' => 'string', 'type' => 'textarea:5:50', 'maxlength' => 255, 'explain' => true, 'default' => ''), |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function display(array $bdata, $edit_mode = false) |
||
92 | |||
93 | /** |
||
94 | * @param array $words_array |
||
95 | * @param array $settings |
||
96 | */ |
||
97 | private function _show_graph(array $words_array, array $settings) |
||
120 | |||
121 | /** |
||
122 | * @param array $words_array |
||
123 | * @param array $settings |
||
124 | */ |
||
125 | private function _get_graph_params(array $words_array, array $settings) |
||
150 | |||
151 | /** |
||
152 | * @param array $settings |
||
153 | * @return array |
||
154 | */ |
||
155 | private function _get_words(array $settings) |
||
171 | |||
172 | /** |
||
173 | * @param string $exclude_words |
||
174 | * @return array |
||
175 | */ |
||
176 | private function _get_words_sql($exclude_words) |
||
199 | |||
200 | /** |
||
201 | * @param string $exclude_words |
||
202 | */ |
||
203 | private function _exclude_words_sql($exclude_words) |
||
214 | |||
215 | /** |
||
216 | * @param string $word |
||
217 | * @param int $count |
||
218 | * @param bool $show_count |
||
219 | * @return string |
||
220 | */ |
||
221 | private function _show_word($word, $count, $show_count) |
||
225 | } |
||
226 |