XML parser callback for ending elements. Used for version 1.0 packages.
152 {
153 array_push($this->element_stack, $name);
154 $this->current_element = $name;
155 $spos = sizeof($this->element_stack) - 2;
156 $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';
157 $this->current_attributes = $attribs;
158 $this->cdata = '';
159 switch ($name) {
160 case 'dir':
161 if ($this->in_changelog) {
162 break;
163 }
164 if (array_key_exists('name', $attribs) && $attribs['name'] != '/') {
165 $attribs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
166 $attribs['name']);
167 if (strrpos($attribs['name'], '/') === strlen($attribs['name']) - 1) {
168 $attribs['name'] = substr($attribs['name'], 0,
169 strlen($attribs['name']) - 1);
170 }
171 if (strpos($attribs['name'], '/') === 0) {
172 $attribs['name'] = substr($attribs['name'], 1);
173 }
174 $this->dir_names[] = $attribs['name'];
175 }
176 if (isset($attribs['baseinstalldir'])) {
177 $this->dir_install = $attribs['baseinstalldir'];
178 }
179 if (isset($attribs['role'])) {
180 $this->dir_role = $attribs['role'];
181 }
182 break;
183 case 'file':
184 if ($this->in_changelog) {
185 break;
186 }
187 if (isset($attribs['name'])) {
188 $path = '';
189 if (count($this->dir_names)) {
190 foreach ($this->dir_names as $dir) {
191 $path .= $dir . '/';
192 }
193 }
194 $path .= preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
195 $attribs['name']);
196 unset($attribs['name']);
197 $this->current_path = $path;
198 $this->filelist[$path] = $attribs;
199
200 if (!isset($this->filelist[$path]['baseinstalldir']) &&
201 isset($this->dir_install))
202 {
203 $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
204 }
205
206 if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
207 $this->filelist[$path]['role'] = $this->dir_role;
208 }
209 }
210 break;
211 case 'replace':
212 if (!$this->in_changelog) {
213 $this->filelist[$this->current_path]['replacements'][] = $attribs;
214 }
215 break;
216 case 'maintainers':
217 $this->_packageInfo['maintainers'] = array();
218 $this->m_i = 0;
219 break;
220 case 'maintainer':
221
222 if (!isset($this->_packageInfo['maintainers'])) {
223 $this->_packageInfo['maintainers'] = array();
224 $this->m_i = 0;
225 }
226 $this->_packageInfo['maintainers'][$this->m_i] = array();
227 $this->current_maintainer =& $this->_packageInfo['maintainers'][$this->m_i];
228 break;
229 case 'changelog':
230 $this->_packageInfo['changelog'] = array();
231 $this->c_i = 0;
232 $this->in_changelog = true;
233 break;
234 case 'release':
235 if ($this->in_changelog) {
236 $this->_packageInfo['changelog'][$this->c_i] = array();
237 $this->current_release = &$this->_packageInfo['changelog'][$this->c_i];
238 } else {
239 $this->current_release = &$this->_packageInfo;
240 }
241 break;
242 case 'deps':
243 if (!$this->in_changelog) {
244 $this->_packageInfo['release_deps'] = array();
245 }
246 break;
247 case 'dep':
248
249 if (!$this->in_changelog) {
250 $this->d_i++;
251 isset($attribs['type']) ? ($attribs['type'] = strtolower($attribs['type'])) : false;
252 $this->_packageInfo['release_deps'][$this->d_i] = $attribs;
253 }
254 break;
255 case 'configureoptions':
256 if (!$this->in_changelog) {
257 $this->_packageInfo['configure_options'] = array();
258 }
259 break;
260 case 'configureoption':
261 if (!$this->in_changelog) {
262 $this->_packageInfo['configure_options'][] = $attribs;
263 }
264 break;
265 case 'provides':
266 if (empty($attribs['type']) || empty($attribs['name'])) {
267 break;
268 }
269 $attribs['explicit'] = true;
270 $this->_packageInfo['provides']["$attribs[type];$attribs[name]"] = $attribs;
271 break;
272 case 'package' :
273 if (isset($attribs['version'])) {
274 $this->_packageInfo['xsdversion'] = trim($attribs['version']);
275 } else {
276 $this->_packageInfo['xsdversion'] = '1.0';
277 }
278 if (isset($attribs['packagerversion'])) {
279 $this->_packageInfo['packagerversion'] = $attribs['packagerversion'];
280 }
281 break;
282 }
283 }