Subversion Repositories Applications.wikini

Rev

Rev 50 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
50 aurelien 1
<?php
2
class WikiApi {
3
 
4
	private $page = null;
5
	private $wikiObjet = null;
6
	private $cheminWiki = null;
7
	private $cheminApi = null;
8
 
9
	public function __construct($cheminWiki, $cheminApi) {
10
		$this->cheminWiki = $cheminWiki;
11
		$this->cheminApi = $cheminApi;
12
		$this->initialiser();
13
	}
14
 
15
	private function initialiser() {
16
		if ($this->page != null) {
17
        	$_REQUEST['wiki'] = $this->page;
18
        }
19
 
20
		ini_set('include_path',ini_get('include_path').':'.$this->cheminWiki.':');
21
		chdir($this->cheminWiki);
22
        include 'api.php';
23
        $this->wikiObjet = $wiki;
24
        chdir($this->cheminApi);
25
	}
26
 
27
	public function setPageCourante($page) {
28
		$this->page = $page;
29
	}
30
 
31
	public function chargerClasseWiki($classe) {
32
		$chemins = array($this->cheminWiki.'/tools/', $this->cheminWiki.'/formatters/');
33
		foreach ($chemins as $chemin) {
34
			$chemin = $chemin.$classe.'.php';
35
			if (file_exists($chemin)) {
36
				require_once $chemin;
37
				$classeTrouvee = true;
38
			}
39
		}
40
	}
41
 
42
	public function __call($methodeNom, $arguments) {
43
 
44
        if ($this->wikiObjet == null) {
45
        	$this->initialiser();
46
        }
47
 
48
        chdir($this->cheminWiki);
49
        $retour = call_user_func_array(array($this->wikiObjet, $methodeNom), $arguments);
50
        chdir($this->cheminApi);
51
        return $retour;
52
    }
53
}
54
?>