1 | <?php |
||
11 | class Settings extends MetaBox |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | const ID = 'settings'; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | public static $conditions = [ |
||
22 | 'class_exists', 'defined', 'function_exists', 'hook', 'is_plugin_active', |
||
23 | 'is_plugin_inactive', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | public $hook; |
||
30 | |||
31 | /** |
||
32 | * @return string |
||
33 | */ |
||
34 | public static function id() |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | public function init() |
||
58 | |||
59 | /** |
||
60 | * @return void |
||
61 | * @action admin_menu |
||
62 | */ |
||
63 | public function addPage() |
||
75 | |||
76 | /** |
||
77 | * @return void |
||
78 | * @action pollux/{static::ID}/init |
||
79 | */ |
||
80 | public function addSubmitMetaBox() |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | * @filter pollux/{static::ID}/before/instructions |
||
95 | */ |
||
96 | public function filterBeforeInstructions() |
||
100 | |||
101 | /** |
||
102 | * @param string $instruction |
||
103 | * @return string |
||
104 | * @action pollux/{static::ID}/instruction |
||
105 | */ |
||
106 | public function filterInstruction( $instruction, array $field, array $metabox ) |
||
110 | |||
111 | /** |
||
112 | * @param null|array $settings |
||
113 | * @return array |
||
114 | * @callback register_setting |
||
115 | */ |
||
116 | public function filterSavedSettings( $settings ) |
||
123 | |||
124 | /** |
||
125 | * @param string $key |
||
126 | * @param mixed $fallback |
||
127 | * @param string $group |
||
128 | * @return string|array |
||
129 | */ |
||
130 | public function getMetaValue( $key, $fallback = '', $group = '' ) |
||
134 | |||
135 | /** |
||
136 | * @return void |
||
137 | * @action current_screen |
||
138 | */ |
||
139 | public function register() |
||
151 | |||
152 | /** |
||
153 | * @return void |
||
154 | * @action admin_menu |
||
155 | */ |
||
156 | public function registerSetting() |
||
160 | |||
161 | /** |
||
162 | * @return void |
||
163 | * @action admin_print_footer_scripts |
||
164 | */ |
||
165 | public function renderFooterScript() |
||
174 | |||
175 | /** |
||
176 | * @return void |
||
177 | * @callback add_menu_page |
||
178 | */ |
||
179 | public function renderPage() |
||
187 | |||
188 | /** |
||
189 | * @return void |
||
190 | * @callback add_meta_box |
||
191 | */ |
||
192 | public function renderSubmitMetaBox() |
||
206 | |||
207 | /** |
||
208 | * @return void |
||
209 | * @action pollux/{static::ID}/init |
||
210 | */ |
||
211 | public function reset() |
||
227 | |||
228 | /** |
||
229 | * @param string $key |
||
230 | * @return array |
||
231 | */ |
||
232 | protected function filterArrayByKey( array $array, $key ) |
||
238 | |||
239 | /** |
||
240 | * @return array |
||
241 | */ |
||
242 | protected function getDefaults() |
||
257 | |||
258 | protected function getSettings() |
||
262 | |||
263 | /** |
||
264 | * @param string $name |
||
265 | * @param string $parentId |
||
266 | * @return string |
||
267 | */ |
||
268 | protected function normalizeFieldName( $name, array $data, $parentId ) |
||
272 | |||
273 | /** |
||
274 | * @param string $id |
||
275 | * @param string $parentId |
||
276 | * @return string |
||
277 | */ |
||
278 | protected function normalizeId( $id, array $data, $parentId ) |
||
284 | } |
||
285 |