1 | <?php |
||
11 | class Settings extends MetaBox |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | CONST ID = 'pollux_settings'; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | public $hook; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | public $id; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected static $conditions = [ |
||
32 | 'class_exists', 'defined', 'function_exists', 'hook', 'is_plugin_active', |
||
33 | 'is_plugin_inactive', |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function init() |
||
57 | |||
58 | /** |
||
59 | * @return void |
||
60 | * @action admin_menu |
||
61 | */ |
||
62 | public function addPage() |
||
74 | |||
75 | /** |
||
76 | * @return void |
||
77 | * @action pollux/settings/init |
||
78 | */ |
||
79 | public function addSubmitMetaBox() |
||
90 | |||
91 | /** |
||
92 | * @param string $instruction |
||
93 | * @param string $fieldId |
||
94 | * @param string $metaboxId |
||
95 | * @return string |
||
96 | * @filter pollux/settings/instruction |
||
97 | */ |
||
98 | public function filterInstruction( $instruction, $fieldId, $metaboxId ) |
||
102 | |||
103 | /** |
||
104 | * @param string $location |
||
105 | * @return string |
||
106 | * @filter wp_redirect |
||
107 | */ |
||
108 | public function filterRedirectOnSave( $location ) |
||
119 | |||
120 | /** |
||
121 | * @param null|array $settings |
||
122 | * @return array |
||
123 | * @callback register_setting |
||
124 | */ |
||
125 | public function filterSavedSettings( $settings ) |
||
132 | |||
133 | /** |
||
134 | * @return void |
||
135 | * @action current_screen |
||
136 | */ |
||
137 | public function register() |
||
149 | |||
150 | /** |
||
151 | * @return void |
||
152 | * @action admin_menu |
||
153 | */ |
||
154 | public function registerSetting() |
||
158 | |||
159 | /** |
||
160 | * @return void |
||
161 | * @action admin_footer-toplevel_page_{$this->id} |
||
162 | */ |
||
163 | public function renderFooterScript() |
||
171 | |||
172 | /** |
||
173 | * @return void |
||
174 | * @callback add_menu_page |
||
175 | */ |
||
176 | public function renderPage() |
||
184 | |||
185 | /** |
||
186 | * @return void |
||
187 | * @callback add_meta_box |
||
188 | */ |
||
189 | public function renderSubmitMetaBox() |
||
202 | |||
203 | /** |
||
204 | * @return void |
||
205 | * @action pollux/settings/init |
||
206 | */ |
||
207 | public function reset() |
||
218 | |||
219 | /** |
||
220 | * @param string $key |
||
221 | * @return array |
||
222 | */ |
||
223 | protected function filterArrayByKey( array $array, $key ) |
||
229 | |||
230 | /** |
||
231 | * @return array |
||
232 | */ |
||
233 | protected function getDefaults() |
||
248 | |||
249 | /** |
||
250 | * @return string|array |
||
251 | */ |
||
252 | protected function getValue( $key, $group ) |
||
256 | |||
257 | /** |
||
258 | * @param string $name |
||
259 | * @param string $parentId |
||
260 | * @return string |
||
261 | */ |
||
262 | protected function normalizeFieldName( $name, array $data, $parentId ) |
||
270 | |||
271 | /** |
||
272 | * @param string $id |
||
273 | * @param string $parentId |
||
274 | * @return string |
||
275 | */ |
||
276 | protected function normalizeId( $id, array $data, $parentId ) |
||
282 | } |
||
283 |