aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Web/SubModule.php
blob: 122766d5a1ee752a06391432843af4a5707fd41f (plain) (blame)
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
<?php

namespace Zotlabs\Web;


class SubModule {

	private $controller = false;

	function __construct() {

		if(argc() < 2)
			return;

		$filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv(1)) . '.php';
		$modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv(1));
		if(file_exists($filename)) {
			$this->controller = new $modname();
		}
	}

	function call($method) {
		if(! $this->controller)
			return false;
		if(method_exists($this->controller,$method))
			return $this->controller->$method();
		return false;
	}

}