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

Public Member Functions

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

Data Fields

 $success = false
 
 $props = false
 
 $depth = 0
 

Detailed Description

Definition at line 30 of file _parse_propfind.php.

Constructor & Destructor Documentation

◆ __construct()

_parse_propfind::__construct (   $path)

constructor

public

Definition at line 62 of file _parse_propfind.php.

References $path, and array.

63  {
64  // success state flag
65  $this->success = true;
66 
67  // property storage array
68  $this->props = array();
69 
70  // internal tag depth counter
71  $this->depth = 0;
72 
73  // remember if any input was parsed
74  $had_input = false;
75 
76  // open input stream
77  $f_in = fopen($path, "r");
78  if (!$f_in) {
79  $this->success = false;
80  return;
81  }
82 
83  // create XML parser
84  $xml_parser = xml_parser_create_ns("UTF-8", " ");
85 
86  // set tag and data handlers
87  xml_set_element_handler(
88  $xml_parser,
89  array(&$this, "_startElement"),
90  array(&$this, "_endElement")
91  );
92 
93  // we want a case sensitive parser
94  xml_parser_set_option(
95  $xml_parser,
96  XML_OPTION_CASE_FOLDING,
97  false
98  );
99 
100 
101  // parse input
102  while ($this->success && !feof($f_in)) {
103  $line = fgets($f_in);
104  if (is_string($line)) {
105  $had_input = true;
106  $this->success &= xml_parse($xml_parser, $line, false);
107  }
108  }
109 
110  // finish parsing
111  if ($had_input) {
112  $this->success &= xml_parse($xml_parser, "", true);
113  }
114 
115  // free parser
116  xml_parser_free($xml_parser);
117 
118  // close input stream
119  fclose($f_in);
120 
121  // if no input was parsed it was a request
122  if (!count($this->props)) {
123  $this->props = "all";
124  } // default
125  }
Create styles array
The data for the language used.

Member Function Documentation

◆ _endElement()

_parse_propfind::_endElement (   $parser,
  $name 
)

end tag handler

private

Parameters
resourceparser
stringtag name

Definition at line 181 of file _parse_propfind.php.

182  {
183  // here we only need to decrement the depth count
184  $this->depth--;
185  }

◆ _startElement()

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

start tag handler

private

Parameters
resourceparser
stringtag name
arraytag attributes

Definition at line 136 of file _parse_propfind.php.

References $name, $tag, and array.

137  {
138  // name space handling
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  // special tags at level 1: <allprop> and <propname>
150  if ($this->depth == 1) {
151  if ($tag == "allprop") {
152  $this->props = "all";
153  }
154 
155  if ($tag == "propname") {
156  $this->props = "names";
157  }
158  }
159 
160  // requested properties are found at level 2
161  if ($this->depth == 2) {
162  $prop = array("name" => $tag);
163  if ($ns) {
164  $prop["xmlns"] = $ns;
165  }
166  $this->props[] = $prop;
167  }
168 
169  // increment depth count
170  $this->depth++;
171  }
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35

Field Documentation

◆ $depth

_parse_propfind::$depth = 0

Definition at line 54 of file _parse_propfind.php.

◆ $props

_parse_propfind::$props = false

Definition at line 46 of file _parse_propfind.php.

◆ $success

_parse_propfind::$success = false

Definition at line 38 of file _parse_propfind.php.


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