ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
_parse_proppatch Class Reference
+ Collaboration diagram for _parse_proppatch:

Public Member Functions

 __construct ($path)
 constructor More...
 
 _startElement ($parser, $name, $attrs)
 tag start handler More...
 
 _endElement ($parser, $name)
 tag end handler More...
 
 _data ($parser, $data)
 input data handler More...
 

Data Fields

 $success
 
 $props
 
 $depth
 
 $mode
 
 $current
 

Detailed Description

Definition at line 30 of file _parse_proppatch.php.

Constructor & Destructor Documentation

◆ __construct()

_parse_proppatch::__construct (   $path)

constructor

Parameters
stringpath of input stream public

Definition at line 78 of file _parse_proppatch.php.

References $path, and array.

79  {
80  $this->success = true;
81 
82  $this->depth = 0;
83  $this->props = array();
84  $had_input = false;
85 
86  $f_in = fopen($path, "r");
87  if (!$f_in) {
88  $this->success = false;
89  return;
90  }
91 
92  $xml_parser = xml_parser_create_ns("UTF-8", " ");
93 
94  xml_set_element_handler(
95  $xml_parser,
96  array(&$this, "_startElement"),
97  array(&$this, "_endElement")
98  );
99 
100  xml_set_character_data_handler(
101  $xml_parser,
102  array(&$this, "_data")
103  );
104 
105  xml_parser_set_option(
106  $xml_parser,
107  XML_OPTION_CASE_FOLDING,
108  false
109  );
110 
111  while ($this->success && !feof($f_in)) {
112  $line = fgets($f_in);
113  if (is_string($line)) {
114  $had_input = true;
115  $this->success &= xml_parse($xml_parser, $line, false);
116  }
117  }
118 
119  if ($had_input) {
120  $this->success &= xml_parse($xml_parser, "", true);
121  }
122 
123  xml_parser_free($xml_parser);
124 
125  fclose($f_in);
126  }
Create styles array
The data for the language used.

Member Function Documentation

◆ _data()

_parse_proppatch::_data (   $parser,
  $data 
)

input data handler

Parameters
resourceparser
stringdata
Returns
void private

Definition at line 216 of file _parse_proppatch.php.

References $data.

217  {
218  if (isset($this->current)) {
219  $this->current["val"] .= $data;
220  }
221  }

◆ _endElement()

_parse_proppatch::_endElement (   $parser,
  $name 
)

tag end handler

Parameters
resourceparser
stringtag name
Returns
void private

Definition at line 182 of file _parse_proppatch.php.

References $current, $name, and $tag.

183  {
184  if (strstr($name, " ")) {
185  list($ns, $tag) = explode(" ", $name);
186  if ($ns == "") {
187  $this->success = false;
188  }
189  } else {
190  $ns = "";
191  $tag = $name;
192  }
193 
194  $this->depth--;
195 
196  if ($this->depth >= 4) {
197  $this->current["val"] .= "</$tag>";
198  }
199 
200  if ($this->depth == 3) {
201  if (isset($this->current)) {
202  $this->props[] = $this->current;
203  unset($this->current);
204  }
205  }
206  }
if($format !==null) $name
Definition: metadata.php:146
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35

◆ _startElement()

_parse_proppatch::_startElement (   $parser,
  $name,
  $attrs 
)

tag start handler

Parameters
resourceparser
stringtag name
arraytag attributes
Returns
void private

Definition at line 137 of file _parse_proppatch.php.

References $key, $name, $tag, and array.

138  {
139  if (strstr($name, " ")) {
140  list($ns, $tag) = explode(" ", $name);
141  if ($ns == "") {
142  $this->success = false;
143  }
144  } else {
145  $ns = "";
146  $tag = $name;
147  }
148 
149  if ($this->depth == 1) {
150  $this->mode = $tag;
151  }
152 
153  if ($this->depth == 3) {
154  $prop = array("name" => $tag);
155  $this->current = array("name" => $tag, "ns" => $ns, "status"=> 200);
156  if ($this->mode == "set") {
157  $this->current["val"] = ""; // default set val
158  }
159  }
160 
161  if ($this->depth >= 4) {
162  $this->current["val"] .= "<$tag";
163  foreach ($attr as $key => $val) {
164  $this->current["val"] .= ' ' . $key . '="' . str_replace('"', '&quot;', $val) . '"';
165  }
166  $this->current["val"] .= ">";
167  }
168 
169 
170 
171  $this->depth++;
172  }
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35

Field Documentation

◆ $current

_parse_proppatch::$current

Definition at line 70 of file _parse_proppatch.php.

Referenced by _endElement().

◆ $depth

_parse_proppatch::$depth

Definition at line 54 of file _parse_proppatch.php.

◆ $mode

_parse_proppatch::$mode

Definition at line 62 of file _parse_proppatch.php.

◆ $props

_parse_proppatch::$props

Definition at line 46 of file _parse_proppatch.php.

◆ $success

_parse_proppatch::$success

Definition at line 38 of file _parse_proppatch.php.


The documentation for this class was generated from the following file: