1: <?php
2:
3: /*
4: * To change this license header, choose License Headers in Project Properties.
5: * To change this template file, choose Tools | Templates
6: * and open the template in the editor.
7: */
8:
9: namespace academicpuma\citeproc;
10:
11: /**
12: * Description of csl_info
13: *
14: * @author sebastian
15: */
16:
17: class Info {
18:
19: public $title;
20: public $id;
21: public $authors = array();
22: public $links = array();
23:
24: function __construct($dom_node) {
25: $name = array();
26: foreach ($dom_node->childNodes as $node) {
27: if ($node->nodeType == 1) {
28: switch ($node->nodeName) {
29: case 'author':
30: case 'contributor':
31: foreach ($node->childNodes as $authnode) {
32: if ($node->nodeType == 1) {
33: $name[$authnode->nodeName] = $authnode->nodeValue;
34: }
35: }
36: $this->authors[] = $name;
37: break;
38: case 'link':
39: foreach ($node->attributes as $attribute) {
40: $this->links[] = $attribute->value;
41: }
42: break;
43: default:
44: $this->{$node->nodeName} = $node->nodeValue;
45: }
46: }
47: }
48: }
49:
50: }