Subversion Repositories Applications.wikini

Rev

Rev 45 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 45 Rev 46
Line 1... Line 1...
1
<?php
1
<?php
2
class WikiApi {
2
class WikiApi {
3
	
3
 
4
	private $page = null;
4
	private $page = null;
5
	private $wikiObjet = null;
5
	private $wikiObjet = null;
6
	private $cheminWiki = null;
6
	private $cheminWiki = null;
7
	private $cheminApi = null;
7
	private $cheminApi = null;
8
	
8
 
9
	public function __construct($cheminWiki, $cheminApi) {
9
	public function __construct($cheminWiki, $cheminApi) {
10
		$this->cheminWiki = $cheminWiki;
10
		$this->cheminWiki = $cheminWiki;
11
		$this->cheminApi = $cheminApi;
11
		$this->cheminApi = $cheminApi;
12
	}
12
	}
13
	
13
 
14
	private function initialiser() {
14
	private function initialiser() {
15
		if ($this->page != null) {
15
		if ($this->page != null) {
16
        	$_REQUEST['wiki'] = $this->page;
16
			$_REQUEST['wiki'] = $this->page;
17
		}
17
		}
18
		
18
 
19
	ini_set('include_path',ini_get('include_path').':'.$this->cheminWiki.':');
19
		ini_set('include_path',ini_get('include_path').':'.$this->cheminWiki.':');
20
	chdir($this->cheminWiki);
20
		chdir($this->cheminWiki);
21
        include 'api.php';
21
		include 'api.php';
22
        $this->wikiObjet = $wiki;
22
		$this->wikiObjet = $wiki;
23
        chdir($this->cheminApi);
23
		chdir($this->cheminApi);
24
	}
24
	}
25
	
25
 
26
	public function setPageCourante($page) {
26
	public function setPageCourante($page) {
27
		$this->page = $page;
27
		$this->page = $page;
28
	}
28
	}
29
	
29
 
30
	public function __call($methodeNom, $arguments) {
30
	public function __call($methodeNom, $arguments) {
31
        if ($this->wikiObjet == null) {
31
		if ($this->wikiObjet == null) {
32
        	$this->initialiser();
32
			$this->initialiser();
33
        }
33
		}
34
        	
34
 
35
        chdir($this->cheminWiki);
35
		chdir($this->cheminWiki);
36
        $retour = call_user_func_array(array($this->wikiObjet, $methodeNom), $arguments);
36
		$retour = call_user_func_array(array($this->wikiObjet, $methodeNom), $arguments);
37
        chdir($this->cheminApi);
37
		chdir($this->cheminApi);
38
        return $retour;
38
		return $retour;
39
    }
39
	}
40
}
40
}
41
?>
41
?>
42
42