document.php
1.24 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
67
68
<?php
class Document {
private $title;
private $description;
private $keywords;
private $links = array();
private $styles = array();
private $scripts = array();
public function setTitle($title) {
$this->title = $title;
}
public function getTitle() {
return $this->title;
}
public function setDescription($description) {
$this->description = $description;
}
public function getDescription() {
return $this->description;
}
public function setKeywords($keywords) {
$this->keywords = $keywords;
}
public function getKeywords() {
return $this->keywords;
}
public function addLink($href, $rel) {
$this->links[$href] = array(
'href' => $href,
'rel' => $rel
);
}
public function getLinks() {
return $this->links;
}
public function addStyle($href, $rel = 'stylesheet', $media = 'screen') {
$this->styles[$href] = array(
'href' => $href,
'rel' => $rel,
'media' => $media
);
}
public function getStyles() {
return $this->styles;
}
public function addScript($href, $postion = 'header') {
$this->scripts[$postion][$href] = $href;
}
public function getScripts($postion = 'header') {
if (isset($this->scripts[$postion])) {
return $this->scripts[$postion];
} else {
return array();
}
}
}