Subversion Repositories personal-webbase

Rev

Rev 1 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 daniel-mar 1
<?php
2
 
3
class WebBase_Design_Info
4
{
5
        private $f_name;
6
        private $f_author;
7
        private $f_version;
8
 
9
        // 0 = Third-Party-Product
10
        // 1 = Official Product
11
        private $f_license;
12
 
13
        function name() {
14
                return $this->f_name;
15
        }
16
 
17
        function author() {
18
                return $this->f_author;
19
        }
20
 
21
        function version() {
22
                return $this->f_version;
23
        }
24
 
25
        function license() {
26
                return $this->f_license;
27
        }
28
 
29
        function WebBase_Design_Info($name, $author, $version, $license) {
30
                $this->f_name = $name;
31
                $this->f_author = $author;
32
                $this->f_version = $version;
33
                $this->f_license = $license;
34
        }
35
};
36
 
37
class WBModuleHandler {
38
 
39
        private static $cache_design_information = Array();
40
 
41
        function get_design_information($designname)
42
        {
43
                if (isset(self::$cache_design_information[$designname])) {
44
                        return self::$cache_design_information[$designname];
45
                }
46
 
47
                if (function_exists('getmicrotime')) $ss = getmicrotime();
48
 
49
                $xml = new xml();
50
 
51
                if ((!strpos($designname, '..')) && (file_exists('designs/'.$designname.'/info.xml')))
52
                {
53
                        $object = $xml->xml_file_to_object('designs/'.$designname.'/info.xml');
54
 
55
                        if ($object->name == 'designinfo')
56
                        {
57
                                $v_name = '';
58
                                $v_author = '';
59
                                $v_version = '';
60
                                $v_license = '';
61
 
62
                                foreach ($object->children as $m1 => $m2)
63
                                {
64
                                        if ($object->children[$m1]->name == 'name') $v_name = $object->children[$m1]->content;
65
                                        if ($object->children[$m1]->name == 'author') $v_author = $object->children[$m1]->content;
66
                                        if ($object->children[$m1]->name == 'version') $v_version = $object->children[$m1]->content;
67
                                        if ($object->children[$m1]->name == 'license') $v_license = $object->children[$m1]->content;
68
                                }
69
 
70
                                $output = new WebBase_Design_Info($v_name, $v_author, $v_version, $v_license);
71
 
72
                                if ($output->name == '') $output->name = $designname;
73
 
74
                                if (function_exists('getmicrotime')) {
75
                                        $ee = getmicrotime();
76
                                        global $xml_time;
77
                                        $xml_time += $ee-$ss;
78
                                        global $xml_count;
79
                                        $xml_count++;
80
                                }
81
 
82
                                self::$cache_design_information[$designname] = $output;
83
 
84
                                return $output;
85
                        }
86
                        else
87
                        {
88
                                return NULL;
89
                        }
90
                }
91
                else
92
                {
93
                        return NULL;
94
                }
95
        }
96
}
97
 
98
?>
99
 
100
?>