1 | <?php |
||
16 | class main_module |
||
17 | { |
||
18 | /** @var \phpbb\cache\driver\driver_interface $cache */ |
||
19 | protected $cache; |
||
20 | |||
21 | /** @var \phpbb\config\config $config */ |
||
22 | protected $config; |
||
23 | |||
24 | /** @var \phpbb\config\db_text $config_text */ |
||
25 | protected $config_text; |
||
26 | |||
27 | /** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */ |
||
28 | protected $container; |
||
29 | |||
30 | /** @var \phpbb\request\request $request */ |
||
31 | protected $request; |
||
32 | |||
33 | /** @var \phpbb\template\template $template */ |
||
34 | protected $template; |
||
35 | |||
36 | /** @var \phpbb\language\language $language */ |
||
37 | protected $language; |
||
38 | |||
39 | /** @var \phpbb\log\log $log */ |
||
40 | protected $log; |
||
41 | |||
42 | /** @var \phpbb\user */ |
||
43 | protected $user; |
||
44 | |||
45 | /** @var array $enabled_sites */ |
||
46 | protected $enabled_sites; |
||
47 | |||
48 | /** @var string $form_key */ |
||
49 | protected $form_key; |
||
50 | |||
51 | /** @var string $page_title */ |
||
52 | public $page_title; |
||
53 | |||
54 | /** @var string $tpl_name */ |
||
55 | public $tpl_name; |
||
56 | |||
57 | /** @var string $u_action */ |
||
58 | public $u_action; |
||
59 | |||
60 | /** |
||
61 | * Constructor |
||
62 | */ |
||
63 | public function __construct() |
||
80 | |||
81 | /** |
||
82 | * Main ACP module |
||
83 | * |
||
84 | * @param int $id The module ID |
||
85 | * @param string $mode The module mode |
||
86 | */ |
||
87 | public function main($id, $mode) |
||
107 | |||
108 | /** |
||
109 | * Display data in the ACP module |
||
110 | * |
||
111 | * @param string $mode The ACP module mode (manage|settings) |
||
112 | * @param array $data Array of data to assign to the template |
||
113 | */ |
||
114 | protected function display($mode, $data) |
||
123 | |||
124 | /** |
||
125 | * Get a list of available sites |
||
126 | * |
||
127 | * @return array An array of available sites |
||
128 | */ |
||
129 | protected function get_sites() |
||
150 | |||
151 | /** |
||
152 | * Get enabled media sites stored in the database |
||
153 | * |
||
154 | * @return array An array of enabled sites |
||
155 | */ |
||
156 | protected function get_enabled_sites() |
||
166 | |||
167 | /** |
||
168 | * Save site managed data to the database |
||
169 | */ |
||
170 | protected function save_manage() |
||
183 | |||
184 | /** |
||
185 | * Save settings data to the database |
||
186 | */ |
||
187 | protected function save_settings() |
||
197 | |||
198 | /** |
||
199 | * Check the form key, trigger error if invalid |
||
200 | */ |
||
201 | protected function check_form_key() |
||
208 | } |
||
209 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state