CMISObjectTypes.inc.php
1.33 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
class CMISObjectTypes {
/**
*
* @var array $objects The array of supported object types
*/
private $objects;
private $path;
function __construct()
{
// TODO Set path dynamically instead of statically? i.e. via config as with search
$this->path = CMIS_DIR . '/objecttypes';
$this->registerObjects();
}
function registerObjects()
{
// read object types directory to find supported object types
$this->objects = array();
// TODO check search code for correctPath function and see if similar is needed here
$dir = opendir($this->path);
while (($file = readdir($dir)) !== false)
{
if (substr($file,-14) == 'Object.inc.php')
{
// TODO check what if anything here is useful and reinstate
// require_once($this->path . '/' . $file);
// $class = substr($file, 0, -8);
//
// if (!class_exists($class))
// {
// continue;
// }
//
// $field = new $class;
// if (is_null($field) || !($field instanceof FieldExpr))
// {
// continue;
// }
$this->objects[] = str_replace('CMIS', '', substr($file,0,-14));
}
}
closedir($dir);
}
/**
* return a list of all supported objects
*/
function getObjectTypes()
{
return $this->objects;
}
}
?>