diff options
Diffstat (limited to 'src/lib/MessageHandler.class.php')
-rw-r--r-- | src/lib/MessageHandler.class.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/lib/MessageHandler.class.php b/src/lib/MessageHandler.class.php new file mode 100644 index 0000000..2dce491 --- /dev/null +++ b/src/lib/MessageHandler.class.php @@ -0,0 +1,55 @@ +<?php + + +require_once('send/SenderGVSMS.class.php'); +require_once('send/SenderIdentica.class.php'); + +set_include_path(get_include_path().PATH_SEPARATOR."$BASE/src/plugins"); + +class MessageHandler { + public function __constructor() { + + } + public function loadPlugin($plugin_name) { + global $m; + + require_once("$plugin.class.php"); + $obj = new $plugin; + $params = call_user_func("$plugin::configList"); + foreach ($params as $param => $type) { + $value = $m->getPluginConf($plugin, $param); + if ($value!==false) { + switch ($type) { + case 'text': + case 'password': + $value = "$value"; + break; + case 'int': + $value = (int)$value; + break; + } + configSet($param, $value); + } + } + return $obj; + } + public function main() { + global $BASE; + + $private_senders = array(); + $broadcast_senders = array(); + + $plugin_list = $m->getSysConf('plugins'); + $plugins = explode(',', $plugin_list); + foreach ($plugins as $plugin) { + require_once("$plugin.class.php"); + if (is_subclass_of($plugin, 'SenderPrivate')) { + $private_senders[] = $this->loadPlugin($plugin); + } + if (is_subclass_of($plugin, 'SenderBroadcast')) { + $broadcast_senders[] = $this->loadPlugin($plugin); + } + } + //foreach ($private_senders) + } +}
\ No newline at end of file |