-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
56 lines (37 loc) · 1.48 KB
/
init.php
File metadata and controls
56 lines (37 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
add_action('plugins_loaded', function () use ($framework) {
$configs = $framework->get_plugin_configs();
if (empty($configs)) return;
foreach ($configs as $config) {
$framework->register_admin_menu($config);
$framework->settings_action($config); // Must run before loading features
$framework->load_plugin_features($config);
}
}, 99); // After all register_plugin called
// Themes
add_action('after_setup_theme', function() use ($framework) {
$theme_configs = $framework->get_theme_configs();
$store_available = !empty($framework->get_store_url());
foreach ($theme_configs as $config) {
if (!$store_available || $config['item_id']===false) continue;
// Theme updater and license
$framework->register_theme_updater($config);
}
});
// This runs after the above
add_action('admin_init', function() use ($framework) {
$configs = $framework->get_plugin_configs();
$store_available = !empty($framework->get_store_url());
foreach ($configs as $config) {
$framework->register_setting_fields($config);
$framework->register_admin_notices($config);
$framework->register_dependency_check($config);
$framework->register_action_links($config);
if (!$store_available || $config['item_id']===false) continue;
// Plugin updater and license
$framework->register_updater($config);
$framework->register_license_field($config);
$framework->register_license_notice($config);
$framework->license_action($config);
}
}, 0);