1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14: class Horde_Xml_Wbxml_DtdManager
15: {
16: 17: 18:
19: protected $_strDTD = array();
20:
21: 22: 23:
24: protected $_strDTDURI = array();
25:
26: 27:
28: public function __construct()
29: {
30: $this->registerDTD(Horde_Xml_Wbxml_Dtd::SYNCML_1_0, 'syncml:syncml1.0', new Horde_Xml_Wbxml_Dtd_SyncMl(0));
31: $this->registerDTD(Horde_Xml_Wbxml_Dtd::SYNCML_1_1, 'syncml:syncml1.1', new Horde_Xml_Wbxml_Dtd_SyncMl(1));
32: $this->registerDTD(Horde_Xml_Wbxml_Dtd::SYNCML_1_2, 'syncml:syncml1.2', new Horde_Xml_Wbxml_Dtd_SyncMl(2));
33:
34: $this->registerDTD(Horde_Xml_Wbxml_Dtd::METINF_1_0, 'syncml:metinf1.0', new Horde_Xml_Wbxml_Dtd_SyncMlMetInf(0));
35: $this->registerDTD(Horde_Xml_Wbxml_Dtd::METINF_1_1, 'syncml:metinf1.1', new Horde_Xml_Wbxml_Dtd_SyncMlMetInf(1));
36: $this->registerDTD(Horde_Xml_Wbxml_Dtd::METINF_1_2, 'syncml:metinf1.2', new Horde_Xml_Wbxml_Dtd_SyncMlMetInf(2));
37:
38: $this->registerDTD(Horde_Xml_Wbxml_Dtd::DEVINF_1_0, 'syncml:devinf1.0', new Horde_Xml_Wbxml_Dtd_SyncMlDevInf(0));
39: $this->registerDTD(Horde_Xml_Wbxml_Dtd::DEVINF_1_1, 'syncml:devinf1.1', new Horde_Xml_Wbxml_Dtd_SyncMlDevInf(1));
40: $this->registerDTD(Horde_Xml_Wbxml_Dtd::DEVINF_1_2, 'syncml:devinf1.2', new Horde_Xml_Wbxml_Dtd_SyncMlDevInf(2));
41: }
42:
43: 44:
45: public function getInstance($publicIdentifier)
46: {
47: $publicIdentifier = Horde_String::lower($publicIdentifier);
48: if (isset($this->_strDTD[$publicIdentifier])) {
49: return $this->_strDTD[$publicIdentifier];
50: }
51: }
52:
53: 54:
55: public function getInstanceURI($uri)
56: {
57: $uri = Horde_String::lower($uri);
58: if (isset($this->_strDTDURI[$uri])) {
59: return $this->_strDTDURI[$uri];
60: }
61: }
62:
63: 64:
65: public function registerDTD($publicIdentifier, $uri, $dtd)
66: {
67: $dtd->setDPI($publicIdentifier);
68:
69: $publicIdentifier = Horde_String::lower($publicIdentifier);
70:
71: $this->_strDTD[$publicIdentifier] = $dtd;
72: $this->_strDTDURI[Horde_String::lower($uri)] = $dtd;
73: }
74: }
75: