-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
50 lines (41 loc) · 1.17 KB
/
index.php
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
<?php
define("BASE_PATH", dirname(__FILE__));
// Configuration
require_once BASE_PATH.'/ConfigProvider.interface.php';
require_once BASE_PATH.'/PHPFileConfig.class.php';
ConfigProvider::create("PHPFileConfig");
// Basic requirements
require_once BASE_PATH.'/Plugin.class.php';
require_once BASE_PATH.'/Template.class.php';
// Plugins
include(BASE_PATH.'/plugins/foursquare.php');
include(BASE_PATH.'/plugins/trakt.php');
$header = "";
function addToHeader($html) {
global $header;
$header .= $html;
}
// Get alll plugins into an array
$plugins = array_filter(get_declared_classes(), function($className) {
return in_array('Plugin', class_parents($className));
});
// Run each plugin
$plugin_data = array();
foreach ($plugins as $plugin_class) {
// Instanciate the plugin
$plugin = new $plugin_class();
if ($plugin->isActive()) {
// Render out the plugin's data
$plugin_data[] = array(
"name" =>$plugin->getName(),
"content" => $plugin->renderToString(),
"cosm_feed" => $cosm["feeds"][$plugin->getName()]
);
}
}
// Render the complete site
$template = new Template("derpface.view.php", array(
"header" => $header,
"plugins" => $plugin_data
));
$template->render();