-
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathtest.domit.php
More file actions
executable file
·66 lines (60 loc) · 1.58 KB
/
Copy pathtest.domit.php
File metadata and controls
executable file
·66 lines (60 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
include('domit/xml_domit_include.php');
$doc =& new DOMIT_Document();
$success = $doc->loadXML('content/test.xml');
$curated = $doc->documentElement;
$softwares = $curated->childNodes;
$softwareObjs = array();
foreach ($softwares as $software)
{
$s = new Software($software);
$s->display();
}
class Software
{
var $name;
var $by;
var $scroll;
var $resize;
var $width;
var $height;
var $image;
var $description;
var $location;
var $links = array();
function Software($xml)
{
$this->name = $xml->getAttribute('name');
$this->by = $xml->getAttribute('by');
$this->scroll = $xml->getAttribute('scroll');
$this->width = $xml->getAttribute('width');
$this->height = $xml->getAttribute('height');
$image = $xml->getElementsByTagName('image'); $image = $image->toArray();
$this->image = $image[0]->getText();
$description = $xml->getElementsByTagName('description');
$description = $description->toString();
$description = eregi("<description>(.*)<\/description>", $description, $matches);
$this->description = $matches[1];
$location = $xml->getElementsByTagName('location');
$location = $location->item(0);
$this->location = $location->getText();
$links = $xml->getElementsByTagName('link');
$links = $links->toArray();
foreach($links as $link) {
$this->links[] = '<a href="'. $link->getAttribute('href') . '">' . $link->getText() . '</a>';
}
}
function display()
{
echo <<<EOD
<h2>{$this->name}</h2>
<p>by {$this->by}</p>
<p>{$this->description}</p>
<p>Links: </p>
EOD;
foreach ($this->links as $link) {
echo $link . '<br />';
}
}
}
?>