ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPluginReader.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Xml/classes/class.ilSaxParser.php");
5
16{
17
18 function ilPluginReader($a_path, $a_ctype, $a_cname, $a_slot_id, $a_pname)
19 {
20 parent::ilSaxParser($a_path);
21
22die("Deprecated. Plugin information is stored in plugin.php");
23
24 $this->ctype = $a_ctype;
25 $this->cname = $a_cname;
26 $this->slot_id = $a_slot_id;
27 $this->pname = $a_pname;
28 }
29
30 function startParsing()
31 {
32 parent::startParsing();
33 }
34
35 function setHandlers($a_xml_parser)
36 {
37 xml_set_object($a_xml_parser,$this);
38 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
39 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
40 }
41
50 function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
51 {
52 global $ilDB;
53
54 switch ($a_name)
55 {
56 case 'plugin':
57
58 // check whether record exists
59 $q = "SELECT * FROM il_plugin WHERE ".
60 " component_type = ".$ilDB->quote($this->ctype, "text").
61 " AND component_name = ".$ilDB->quote($this->cname, "text").
62 " AND slot_id = ".$ilDB->quote($this->slot_id, "text").
63 " AND name = ".$ilDB->quote($this->pname, "text");
64 $set = $ilDB->query($q);
65 if ($ilDB->numRows($set) == 0)
66 {
67 $q = "INSERT INTO il_plugin (component_type,component_name,slot_id,".
68 "name, id, last_update_version, current_version, ilias_min_version,".
69 " ilias_max_version, active) VALUES ".
70 "(".$ilDB->quote($this->ctype, "text").",".
71 $ilDB->quote($this->cname, "text").",".
72 $ilDB->quote($this->slot_id, "text").",".
73 $ilDB->quote($this->pname, "text").",".
74 $ilDB->quote($a_attribs["id"], "text").",".
75 $ilDB->quote("0.0.0", "text").",".
76 $ilDB->quote($a_attribs["version"], "text").",".
77 $ilDB->quote($a_attribs["ilias_min_version"], "text").",".
78 $ilDB->quote($a_attribs["ilias_max_version"], "text").",".
79 $ilDB->quote(0, "integer").")";
80 $ilDB->manipulate($q);
81 }
82 else
83 {
84 $q = "UPDATE il_plugin SET ".
85 " id = ".$ilDB->quote($a_attribs["id"], "text").",".
86 " current_version = ".$ilDB->quote($a_attribs["version"], "text").",".
87 " ilias_min_version = ".$ilDB->quote($a_attribs["ilias_min_version"], "text").",".
88 " ilias_max_version = ".$ilDB->quote($a_attribs["ilias_max_version"], "text").
89 " WHERE ".
90 " component_type = ".$ilDB->quote($this->ctype, "text").
91 " AND component_name = ".$ilDB->quote($this->cname, "text").
92 " AND slot_id = ".$ilDB->quote($this->slot_id, "text").
93 " AND name = ".$ilDB->quote($this->pname, "text");
94 $ilDB->manipulate($q);
95 }
96 break;
97 }
98 }
99
107 function handlerEndTag($a_xml_parser,$a_name)
108 {
109
110 }
111
112
120 function handlerCharacterData($a_xml_parser,$a_data)
121 {
122 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
123 $a_data = preg_replace("/\n/","",$a_data);
124 $a_data = preg_replace("/\t+/","",$a_data);
125
126 if (!empty($a_data))
127 {
128 switch ($this->current_tag)
129 {
130 case '':
131 }
132 }
133 }
134
135}
Class ilPluginReader.
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class @access private
handlerCharacterData($a_xml_parser, $a_data)
end tag handler
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
handlerEndTag($a_xml_parser, $a_name)
end tag handler
ilPluginReader($a_path, $a_ctype, $a_cname, $a_slot_id, $a_pname)
startParsing()
stores xml data in array
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
global $ilDB