-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
54 lines (41 loc) · 1.21 KB
/
index.php
File metadata and controls
54 lines (41 loc) · 1.21 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
<?php
namespace tangible\framework;
use tangible\framework;
framework::$state->plugins = [];
/**
* Register a plugin
*
* Call this from action `plugins_loaded`. This is meant to support a minimum
* subset of the plugin framework to ease migration.
*/
function register_plugin($config) {
// Object with dynamic properties and methods - See ../object
$plugin = \tangible\create_object($config + [
// ..Defaults..
]);
framework::$state->plugins []= $plugin;
framework\load_plugin_features( $plugin );
framework\check_plugin_dependencies( $plugin );
if (isset($plugin->settings)) {
framework\register_plugin_settings($plugin, $plugin->settings);
}
return $plugin;
}
function register_theme($config) {
return register_plugin($config + [
'is_theme' => true
]);
}
function get_plugin($name, $theme = false) {
foreach (framework::$state->plugins as $plugin) {
if ($plugin->name === $name && ($plugin->is_theme ?? false) === $theme) {
return $plugin;
}
}
}
function get_theme($name) {
return framework\get_plugin($name, true);
}
require_once __DIR__ . '/dependencies/index.php';
require_once __DIR__ . '/features/index.php';
require_once __DIR__ . '/settings/index.php';