From 12f6c2acb29cbea6f41d1152eb27affa358c196f Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Tue, 30 Oct 2012 15:28:52 +0100 Subject: Refactor to a general, flexible and extensible architecture. --- main.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'main.php') diff --git a/main.php b/main.php index fee0f33..2388e8f 100644 --- a/main.php +++ b/main.php @@ -2,15 +2,22 @@ run(); +if (!empty($config['plugin']) && !empty($config[$config['plugin']])) { + $plugin_file = 'plugins/' . $config['plugin'] . '/' . $config['plugin'] . '.module'; + if (file_exists(ROOT . $plugin_file)) { + require_once ROOT . $plugin_file; + $function = $config['plugin'] . '_init'; + $function($config[$config['plugin']])->run(); + } + else { + fwrite($err, "Plugin <{$plugin_file}> not found.\n"); + } +} +else { + fwrite($err, 'Incomplete configuration: $config[\'plugin\'] must be set to , and $config[] populated.' . "\n"); +} -- cgit v1.1