1 | <?php |
||
12 | class routes |
||
13 | { |
||
14 | /** @var \phpbb\cache\driver\driver_interface */ |
||
15 | protected $cache; |
||
16 | |||
17 | /** @var \phpbb\config\config */ |
||
18 | protected $config; |
||
19 | |||
20 | /** @var \blitze\sitemaker\services\blocks\factory */ |
||
21 | protected $block_factory; |
||
22 | |||
23 | /** @var \blitze\sitemaker\model\mapper_factory */ |
||
24 | protected $mapper_factory; |
||
25 | |||
26 | public $sub_route = false; |
||
27 | |||
28 | /** |
||
29 | * Constructor |
||
30 | * |
||
31 | * @param \phpbb\cache\driver\driver_interface $cache Cache driver interface |
||
32 | * @param \phpbb\config\config $config Config object |
||
33 | * @param \blitze\sitemaker\services\blocks\factory $block_factory Blocks factory object |
||
34 | * @param \blitze\sitemaker\model\mapper_factory $mapper_factory Mapper factory object |
||
35 | */ |
||
36 | 32 | public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \blitze\sitemaker\services\blocks\factory $block_factory, \blitze\sitemaker\model\mapper_factory $mapper_factory) |
|
43 | |||
44 | /** |
||
45 | * @param string $current_route |
||
46 | * @param int $style_id |
||
47 | * @param bool|false $edit_mode |
||
48 | * @return array |
||
49 | */ |
||
50 | 15 | public function get_route_info($current_route, $style_id, $edit_mode = false) |
|
67 | |||
68 | /** |
||
69 | * @param array $route_info |
||
70 | * @param int $style_id |
||
71 | * @param bool $edit_mode |
||
72 | * @return array |
||
73 | */ |
||
74 | 15 | public function get_blocks_for_route(array $route_info, $style_id, $edit_mode) |
|
81 | |||
82 | /** |
||
83 | * @param array $df_settings |
||
84 | * @param array $db_settings |
||
85 | * @return array |
||
86 | */ |
||
87 | 29 | public function sync_settings(array $df_settings, array $db_settings = array()) |
|
101 | |||
102 | /** |
||
103 | * Clear blocks cache |
||
104 | */ |
||
105 | 1 | public function clear_cache() |
|
106 | { |
||
107 | 1 | $this->cache->destroy('sitemaker_blocks'); |
|
108 | 1 | $this->cache->destroy('sitemaker_block_routes'); |
|
109 | 1 | } |
|
110 | |||
111 | /** |
||
112 | * @param bool $edit_mode |
||
113 | * @return array |
||
114 | */ |
||
115 | 15 | protected function get_cached_blocks($edit_mode) |
|
125 | |||
126 | /** |
||
127 | * @return array |
||
128 | */ |
||
129 | 15 | protected function get_all_blocks() |
|
154 | |||
155 | /** |
||
156 | * @return array|mixed |
||
157 | */ |
||
158 | 15 | protected function get_all_routes() |
|
178 | |||
179 | /** |
||
180 | * @param array $all_routes |
||
181 | * @param string $current_route |
||
182 | * @param int $style_id |
||
183 | * @param bool $edit_mode |
||
184 | * @return array |
||
185 | */ |
||
186 | 6 | protected function get_default_route_info(array $all_routes, $current_route, $style_id, $edit_mode, &$is_sub_route) |
|
203 | |||
204 | /** |
||
205 | * @param array $all_routes |
||
206 | * @param string $current_route |
||
207 | * @param int $style_id |
||
208 | * @param bool $edit_mode |
||
209 | * @param bool $is_sub_route |
||
210 | * @return string |
||
211 | */ |
||
212 | 6 | protected function get_parent_route(array $all_routes, $current_route, $style_id, $edit_mode, &$is_sub_route) |
|
229 | |||
230 | /** |
||
231 | * @param array $all_routes |
||
232 | * @param int $style_id |
||
233 | * @return array |
||
234 | */ |
||
235 | 6 | protected function get_routes_for_style(array $all_routes, $style_id) |
|
239 | |||
240 | /** |
||
241 | * @param array $route_info |
||
242 | * @param int $style_id |
||
243 | * @param bool $edit_mode |
||
244 | * @return int |
||
245 | */ |
||
246 | 15 | protected function get_display_route_id(array $route_info, $style_id, $edit_mode) |
|
257 | |||
258 | /** |
||
259 | * @param array $blocks |
||
260 | * @param bool $edit_mode |
||
261 | */ |
||
262 | 15 | protected function cache_block(array $blocks, $edit_mode) |
|
269 | } |
||
270 |